unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Committing only specific hunks in VC
@ 2011-01-11  5:40 Deniz Dogan
  2011-01-11 22:57 ` suvayu ali
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Deniz Dogan @ 2011-01-11  5:40 UTC (permalink / raw)
  To: emacs-help

I have a bunch of files that have been modified and I'd like to commit
all of these changes except for one hunk in one of the files.

How would I do this from Emacs? I've heard that it's possible to stage
only specific hunks in magit, but I'm using Mercurial.

-- 
Deniz Dogan



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Committing only specific hunks in VC
       [not found] <mailman.5.1294724484.29161.help-gnu-emacs@gnu.org>
@ 2011-01-11 17:28 ` Stefan Monnier
  0 siblings, 0 replies; 8+ messages in thread
From: Stefan Monnier @ 2011-01-11 17:28 UTC (permalink / raw)
  To: help-gnu-emacs

> I have a bunch of files that have been modified and I'd like to commit
> all of these changes except for one hunk in one of the files.
> How would I do this from Emacs?

For many years, I've had a local patch to do that in VC, but I recently
threw it out, deciding that it deserves to be rewritten based on the
"new" tools available currently, i.e. stash/shelve.

> I've heard that it's possible to stage
> only specific hunks in magit, but I'm using Mercurial.

I haven't used Mercurial enough, but I'd do a "hg shelve" (or "hg
stash" or whatever it's called and if hg doesn't have such
a functionality, I'd do it by hand: "hg diff >shelve1.diff");
Then I'd use C-x v, diff-mode and friends to add/remove changes to get
just the changes I want to commit;
Then "hg commit";
Then "hg unshelve" or "hg unstash" or "patch -p0 <shelve1.diff";
And resolve the potential conflicts, if any.


        Stefan


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Committing only specific hunks in VC
  2011-01-11  5:40 Committing only specific hunks in VC Deniz Dogan
@ 2011-01-11 22:57 ` suvayu ali
  2011-01-12  8:53   ` Alberto Luaces
  2011-01-12  9:40 ` Oleksandr Gavenko
       [not found] ` <mailman.33.1294825218.12535.help-gnu-emacs@gnu.org>
  2 siblings, 1 reply; 8+ messages in thread
From: suvayu ali @ 2011-01-11 22:57 UTC (permalink / raw)
  To: Deniz Dogan; +Cc: emacs-help

On Mon, Jan 10, 2011 at 9:40 PM, Deniz Dogan <deniz.a.m.dogan@gmail.com> wrote:
> I have a bunch of files that have been modified and I'd like to commit
> all of these changes except for one hunk in one of the files.
>
> How would I do this from Emacs? I've heard that it's possible to stage
> only specific hunks in magit, but I'm using Mercurial.

I don't know of a way to do it from Emacs, but with git its trivial to
interactively add the hunks (git add -i file or git add -p file) from
the terminal and then commit from the
terminal or from emacs using vc-dir. Does mercurial has similar
interactive adding facilities?

-- 
Suvayu

Open source is the future. It sets us free.



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Committing only specific hunks in VC
  2011-01-11 22:57 ` suvayu ali
@ 2011-01-12  8:53   ` Alberto Luaces
  2011-01-12  9:03     ` Deniz Dogan
  0 siblings, 1 reply; 8+ messages in thread
From: Alberto Luaces @ 2011-01-12  8:53 UTC (permalink / raw)
  To: help-gnu-emacs

suvayu ali writes:

> On Mon, Jan 10, 2011 at 9:40 PM, Deniz Dogan <deniz.a.m.dogan@gmail.com> wrote:
>> I have a bunch of files that have been modified and I'd like to commit
>> all of these changes except for one hunk in one of the files.
>>
>> How would I do this from Emacs? I've heard that it's possible to stage
>> only specific hunks in magit, but I'm using Mercurial.
>
> I don't know of a way to do it from Emacs, but with git its trivial to
> interactively add the hunks (git add -i file or git add -p file) from
> the terminal and then commit from the
> terminal or from emacs using vc-dir. Does mercurial has similar
> interactive adding facilities?

I think that currently there's no option for doing it from VC. You can
do it from the command line with "hg record". This requires to have the
"record" extension enabled.

-- 
Alberto




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Committing only specific hunks in VC
  2011-01-12  8:53   ` Alberto Luaces
@ 2011-01-12  9:03     ` Deniz Dogan
  0 siblings, 0 replies; 8+ messages in thread
From: Deniz Dogan @ 2011-01-12  9:03 UTC (permalink / raw)
  To: Alberto Luaces; +Cc: help-gnu-emacs

2011/1/12 Alberto Luaces <aluaces@udc.es>:
> suvayu ali writes:
>
>> On Mon, Jan 10, 2011 at 9:40 PM, Deniz Dogan <deniz.a.m.dogan@gmail.com> wrote:
>>> I have a bunch of files that have been modified and I'd like to commit
>>> all of these changes except for one hunk in one of the files.
>>>
>>> How would I do this from Emacs? I've heard that it's possible to stage
>>> only specific hunks in magit, but I'm using Mercurial.
>>
>> I don't know of a way to do it from Emacs, but with git its trivial to
>> interactively add the hunks (git add -i file or git add -p file) from
>> the terminal and then commit from the
>> terminal or from emacs using vc-dir. Does mercurial has similar
>> interactive adding facilities?
>
> I think that currently there's no option for doing it from VC. You can
> do it from the command line with "hg record". This requires to have the
> "record" extension enabled.
>

Thanks, Alberto, exactly what I need.

-- 
Deniz Dogan



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Committing only specific hunks in VC
  2011-01-11  5:40 Committing only specific hunks in VC Deniz Dogan
  2011-01-11 22:57 ` suvayu ali
@ 2011-01-12  9:40 ` Oleksandr Gavenko
       [not found] ` <mailman.33.1294825218.12535.help-gnu-emacs@gnu.org>
  2 siblings, 0 replies; 8+ messages in thread
From: Oleksandr Gavenko @ 2011-01-12  9:40 UTC (permalink / raw)
  To: help-gnu-emacs

On 11.01.2011 7:40, Deniz Dogan wrote:
> I have a bunch of files that have been modified and I'd like to commit
> all of these changes except for one hunk in one of the files.
>
> How would I do this from Emacs? I've heard that it's possible to stage
> only specific hunks in magit, but I'm using Mercurial.
>
I usually save common patch in '.diff' like file.

Then in diff-mode can revert patch (C-c C-r), then apply C-c C-a for 
hunks that
don't  like.

After than commit and revert '.diff' again to apply reverted hunks.

This allow don't depend on deep VCS knowledge and available/missing 
features.

Also I practice storing 2 copy of source - working and original/clean.
Applying parts of '.diff' to clean source tree, test, commit and then update
working tree.




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Committing only specific hunks in VC
       [not found] ` <mailman.33.1294825218.12535.help-gnu-emacs@gnu.org>
@ 2011-01-12 21:06   ` Colin S. Miller
  2011-02-18 19:08     ` jpkotta
  0 siblings, 1 reply; 8+ messages in thread
From: Colin S. Miller @ 2011-01-12 21:06 UTC (permalink / raw)
  To: help-gnu-emacs

Oleksandr Gavenko wrote:
> On 11.01.2011 7:40, Deniz Dogan wrote:
>> I have a bunch of files that have been modified and I'd like to commit
>> all of these changes except for one hunk in one of the files.
>>
>> How would I do this from Emacs? I've heard that it's possible to stage
>> only specific hunks in magit, but I'm using Mercurial.
>>
> I usually save common patch in '.diff' like file.
>

I'd do something similar, when I need to do this in CVS.

I copy the entire tree, and then on the copy use #
M-x cvs-mode and 'd e' to locate the changes I want to remove.

Then I commit from this tree, and afterwards update the original tree.
Patch normally makes a good job of figuring out what to do, unless
one of the non-commited hunks is right beside a commited hunk,
in which case I'd normally delete the original hunk in the conflict and
use 'd e' to decide what parts of the modified hunk to keep.


HTH,
Colin S. Miller
-- 
Replace the obvious in my email address with the first three letters of the hostname to reply.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Committing only specific hunks in VC
  2011-01-12 21:06   ` Colin S. Miller
@ 2011-02-18 19:08     ` jpkotta
  0 siblings, 0 replies; 8+ messages in thread
From: jpkotta @ 2011-02-18 19:08 UTC (permalink / raw)
  To: help-gnu-emacs

On Jan 12, 3:06 pm, "Colin S. Miller" <no-spam-
thank-...@csmiller.demon.co.uk> wrote:
> Oleksandr Gavenko wrote:
> > On 11.01.2011 7:40, Deniz Dogan wrote:
> >> I have a bunch of files that have been modified and I'd like to commit
> >> all of these changes except for one hunk in one of the files.
>
> >> How would I do this from Emacs? I've heard that it's possible to stage
> >> only specific hunks in magit, but I'm using Mercurial.
>
> > I usually save common patch in '.diff' like file.
>
> I'd do something similar, when I need to do this in CVS.
>
> I copy the entire tree, and then on the copy use #
> M-x cvs-mode and 'd e' to locate the changes I want to remove.
>
> Then I commit from this tree, and afterwards update the original tree.
> Patch normally makes a good job of figuring out what to do, unless
> one of the non-commited hunks is right beside a commited hunk,
> in which case I'd normally delete the original hunk in the conflict and
> use 'd e' to decide what parts of the modified hunk to keep.
>
> HTH,
> Colin S. Miller
> --
> Replace the obvious in my email address with the first three letters of the hostname to reply.

Sorry this is very late, I stopped reading these lists for a while.

I've been using a tool called commit-patch.  It's supposed to work
with just about any SCM, but I use it with Mercurial.  It comes with
an elisp file to make it work with vc-mode.  The only trouble I have
with it is if you try to edit the patch in a way that should still let
it apply cleanly, it often complains and does nothing (but I've never
had it corrupt a patch).  It always works for me to selectively remove
hunks from the patch.

http://porkrind.org/commit-patch/

Before I used commit-patch, I used the Mercurial extension crecord.


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2011-02-18 19:08 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-11  5:40 Committing only specific hunks in VC Deniz Dogan
2011-01-11 22:57 ` suvayu ali
2011-01-12  8:53   ` Alberto Luaces
2011-01-12  9:03     ` Deniz Dogan
2011-01-12  9:40 ` Oleksandr Gavenko
     [not found] ` <mailman.33.1294825218.12535.help-gnu-emacs@gnu.org>
2011-01-12 21:06   ` Colin S. Miller
2011-02-18 19:08     ` jpkotta
     [not found] <mailman.5.1294724484.29161.help-gnu-emacs@gnu.org>
2011-01-11 17:28 ` Stefan Monnier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).