[PATCH 0 of 2] commit: add 'Amend' support

32 views
Skip to first unread message

Angel Ezquerra

unread,
Apr 25, 2012, 8:03:43 AM4/25/12
to thg...@googlegroups.com
This patch series adds support for the new --amend option of the hg
commit command.

This comes during the freeze because I had to wait for the mercurial
freeze before properly testing this new feature. Nevertheless I think
that we should try to support it on the next release, since 'commit
--amend' is one of the top new features on mercurial 2.2.

The actual patch which adds support for --amend is the second one. The
first patch simply adds an 'hgversionint' variable to the
tortoisehg.util.hgversion module to make it easier to compare the
current mercurial version with a given version.

In most cases one would not check the actual mercurial version, but
the existence of a given capability, but in this case there is no way
to tell whether the commit command supports amend other than checking
the actual version number.

Steve Borho

unread,
May 3, 2012, 12:59:47 AM5/3/12
to thg...@googlegroups.com
You should be able to check for 'amend' in the command table in
commands.py. I think we did this in other places but I couldn't find
them.

--
Steve Borho

Angel Ezquerra

unread,
May 3, 2012, 1:15:41 AM5/3/12
to thg...@googlegroups.com
OK, I will check into that. Are you ok with the rest of the patch?

I still think it is nice to be able to check the actual mercurial
version, if only for debugging purposes. Also there may be instances
where it is just not possible or easy to check that a given capability
is available.

Angel

Steve Borho

unread,
May 3, 2012, 1:20:35 AM5/3/12
to thg...@googlegroups.com
On Thu, May 3, 2012 at 12:15 AM, Angel Ezquerra
<angel.e...@gmail.com> wrote:
> On Thu, May 3, 2012 at 6:59 AM, Steve Borho <st...@borho.org> wrote:
>> On Wed, Apr 25, 2012 at 7:03 AM, Angel Ezquerra
>> <angel.e...@gmail.com> wrote:
>>> This patch series adds support for the new --amend option of the hg
>>> commit command.
>>>
>>> This comes during the freeze because I had to wait for the mercurial
>>> freeze before properly testing this new feature. Nevertheless I think
>>> that we should try to support it on the next release, since 'commit
>>> --amend' is one of the top new features on mercurial 2.2.
>>>
>>> The actual patch which adds support for --amend is the second one. The
>>> first patch simply adds an 'hgversionint' variable to the
>>> tortoisehg.util.hgversion module to make it easier to compare the
>>> current mercurial version with a given version.
>>>
>>> In most cases one would not check the actual mercurial version, but
>>> the existence of a given capability, but in this case there is no way
>>> to tell whether the commit command supports amend other than checking
>>> the actual version number.
>>
>> You should be able to check for 'amend' in the command table in
>> commands.py.  I think we did this in other places but I couldn't find
>> them.
>>
>> --
>> Steve Borho
>
> OK, I will check into that. Are you ok with the rest of the patch?

Sure, looks fine

> I still think it is nice to be able to check the actual mercurial
> version, if only for debugging purposes. Also there may be instances
> where it is just not possible or easy to check that a given capability
> is available.

understood

--
Steve Borho

Angel Ezquerra

unread,
May 3, 2012, 1:37:29 AM5/3/12
to thg...@googlegroups.com
I looked into checking the command table to confirm that commit has an
amend option. It is possible to do, but it is more complex that I'd
like it to.

Basically, you can do:

from mercurial import commands
commitopts = commands.table['^commit|ci']
canamend = False
for opt in commitopts:
if opt[1] == 'amend':
canamend = True
break

This seems a bit complex compared to just checking the version number.
Is it worth it?

Angel

Steve Borho

unread,
May 3, 2012, 1:51:43 AM5/3/12
to thg...@googlegroups.com
On Thu, May 3, 2012 at 12:37 AM, Angel Ezquerra
I'm fine with a version number check, so long as it's short lived.

--
Steve Borho

Angel Ezquerra

unread,
May 3, 2012, 4:23:24 AM5/3/12
to thg...@googlegroups.com
We usually only support the latest 2 mercurial versions, don't we? We
could make it a point to always remove any check for older releases
after every full release.

Angel
Reply all
Reply to author
Forward
0 new messages