[PATCH 3 of 7 STABLE] doc: add description about file patterns for amend committing

Idan Kamara idankk86 at gmail.com
Fri Apr 27 14:40:18 CDT 2012


On Fri, Apr 27, 2012 at 10:34 PM, Matt Mackall <mpm at selenic.com> wrote:

> On Fri, 2012-04-27 at 22:32 +0300, Idan Kamara wrote:
> > On Fri, Apr 27, 2012 at 8:13 PM, Matt Mackall <mpm at selenic.com> wrote:
> >
> > > On Mon, 2012-04-23 at 00:40 +0900, FUJIWARA Katsunori wrote:
> > > > # HG changeset patch
> > > > # User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
> > > > # Date 1335108650 -32400
> > > > # Branch stable
> > > > # Node ID 265b1cc74c2d0c3a021b3e27bdffb993ca940fb0
> > > > # Parent  d5c200655e65e949e923d4aff372fd4b9ac71994
> > > > doc: add description about file patterns for amend committing
> > > >
> > > > file pattern for commit command works differently between normal
> > > > committing and amend one, but not yet documented about it.
> > > >
> > > > diff -r d5c200655e65 -r 265b1cc74c2d mercurial/commands.py
> > > > --- a/mercurial/commands.py   Mon Apr 23 00:30:45 2012 +0900
> > > > +++ b/mercurial/commands.py   Mon Apr 23 00:30:50 2012 +0900
> > > > @@ -1195,6 +1195,10 @@
> > > >      specified. When a message isn't specified on the command line,
> > > >      the editor will open with the message of the amended commit.
> > > >
> > > > +    If file patterns are specified to amend committing, they are
> used
> > > > +    only to include changes from working directory, not to pick up
> > > changed
> > > > +    files from ones already contained in the parent.
> > >
> > > Sorry, I'm still confused.
> > >
> > > I think that if I've got a file foo.txt I forgot to commit, and I type
> > > 'hg commit --amend foo.txt', it ought to amend the commit to include
> > > ONLY that file. While this is a bit counterintuitive, it allows me to
> > > -uncommit- things by not mentioning a file or using -X.
> > >
> > > Hmm, I see it actually adds that file, but keeps the old files. And -X
> > > won't let me remove a file either. Idan?
> > >
> >
> > That looks intended. I think it's also desirable since it's closer to
> > how commit normally behaves and it seems like the least surprising
> > of the two.
> >
> > Also, changing it will introduce a strange scenario where after
> > 'commit --amend' you might end up with more changes in the
> > working dir.
>
> Ok, so how do I say "I meant to commit just a but I committed a and b"?
>

You'd have to backup (stash?) b, revert it to .^, commit --amend and
finally restore it.


> --
> Mathematics is the supreme nostalgia of our time.
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20120427/4825ce6c/attachment.html>


More information about the Mercurial-devel mailing list