Submitter | Sean Farley |
---|---|
Date | Feb. 20, 2014, 6:52 a.m. |
Message ID | <8ce8e771f4656449181b.1392879165@laptop.local> |
Download | mbox | patch |
Permalink | /patch/3719/ |
State | Superseded |
Commit | aa021ece4506f5e962c8d87ab58ab594a0105ced |
Headers | show |
Comments
On 2/19/14 10:52 PM, "Sean Farley" <sean.michael.farley@gmail.com> wrote: ># HG changeset patch ># User Sean Farley <sean.michael.farley@gmail.com> ># Date 1392878773 21600 ># Thu Feb 20 00:46:13 2014 -0600 ># Node ID 8ce8e771f4656449181b013d7f16f941f2058ece ># Parent 0e2877f8605dcaf4fdf2ab7e0046f1f6f80161dd >templater: shorten pure integers > >+ if test[0] == '0' or i > cl.rev(cl.tip()): I think you can just do "i > len(cl)". Otherwise looks good.
Durham Goode <durham@fb.com> writes: > On 2/19/14 10:52 PM, "Sean Farley" <sean.michael.farley@gmail.com> wrote: > >># HG changeset patch >># User Sean Farley <sean.michael.farley@gmail.com> >># Date 1392878773 21600 >># Thu Feb 20 00:46:13 2014 -0600 >># Node ID 8ce8e771f4656449181b013d7f16f941f2058ece >># Parent 0e2877f8605dcaf4fdf2ab7e0046f1f6f80161dd >>templater: shorten pure integers > >> >>+ if test[0] == '0' or i > cl.rev(cl.tip()): > > I think you can just do "i > len(cl)". Otherwise looks good. Ah, I didn't realize that. Can someone from crew make that change or should I send another version?
Patch
diff --git a/mercurial/templater.py b/mercurial/templater.py --- a/mercurial/templater.py +++ b/mercurial/templater.py @@ -414,11 +414,16 @@ def shortest(context, mapping, args): # Fallback to the slow way. if cl._partialmatch(test) is None: return False try: - int(test) + i = int(test) + # if we are a pure int, then starting with zero will not be + # confused as a rev; or, obviously, if the int larger than the + # value of the tip + if test[0] == '0' or i > cl.rev(cl.tip()): + return True return False except ValueError: return True except error.RevlogError: return False