Submitter | timeless@mozdev.org |
---|---|
Date | Dec. 23, 2015, 7:57 p.m. |
Message ID | <362b7b756dbc8e6e3fc7.1450900627@waste.org> |
Download | mbox | patch |
Permalink | /patch/12307/ |
State | Accepted |
Delegated to: | Yuya Nishihara |
Headers | show |
Comments
On Wed, 23 Dec 2015 13:57:07 -0600, timeless wrote: > # HG changeset patch > # User timeless <timeless@mozdev.org> > # Date 1450897654 0 > # Wed Dec 23 19:07:34 2015 +0000 > # Node ID 362b7b756dbc8e6e3fc7dfbcc8f0e7cc2fcc6955 > # Parent e2aa9c4030c4109e5efa50462ffc6048ca30106f > parents: correct help revset replacements > > Implementing `hg parents -r REV FILE` correctly is hard. > $ hg log -G --template '{rev} {files}\n'; > @ 10 a > | > o 9 a b > |\ > | o 8 a > | | > o | 7 a > | | > +---o 6 b > | |/ > | o 5 b > | | > o | 4 b > | | > +---o 3 > | |/ > +---o 2 > | |/ > | o 1 b > | > o 0 a > > revs 4 and 5 create a conflict. > The conflict is resolved in the same way by both 6 and 9. > > You would hope that parents around 9/10 would point to 9, > but `hg parents` will point to 6 due to the aforementioned bug. > > Here's the winning solution test script and its output. > > echo $a; > echo rp12-max: `hg log -r "max(::p1($a) and file(b)) + max(::p2($a) and file(b))" -q` 2> /dev/null; > echo expected: `hg parents -q -r $a b` 2> /dev/null; This reminded me the issue4817. We'll need a revset to get parents of the given file with linkrev adjustment applied. http://bz.mercurial-scm.org/show_bug.cgi?id=4817 > Note that for 10, the output differs, but again, this is because > of the aforementioned bug. The rp12-max output is "correct", > whereas "expected" is just an unfortunate bug. The abort output > is due to something else. I'm not sure why someone thought it > was important to abort to stdio instead of stderr, but that's > really not my problem here. It would need 2>/dev/null inside ``. > diff --git a/mercurial/commands.py b/mercurial/commands.py > --- a/mercurial/commands.py > +++ b/mercurial/commands.py > @@ -5300,10 +5300,10 @@ > > This command is equivalent to:: > > - hg log -r "parents()" or > - hg log -r "parents(REV)" or > - hg log -r "max(file(FILE))" or > - hg log -r "max(::REV and file(FILE))" > + hg log -r "p1()+p2()" or > + hg log -r "p1(REV)+p2(REV)" or > + hg log -r "max(::p1() and file(FILE))+max(::p2() and file(FILE))" or > + hg log -r "max(::p1(REV) and file(FILE))+max(::p2(REV) and file(FILE))" This change seems correct, so I'll queue the patch 1, thanks.
Patch
diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -5300,10 +5300,10 @@ This command is equivalent to:: - hg log -r "parents()" or - hg log -r "parents(REV)" or - hg log -r "max(file(FILE))" or - hg log -r "max(::REV and file(FILE))" + hg log -r "p1()+p2()" or + hg log -r "p1(REV)+p2(REV)" or + hg log -r "max(::p1() and file(FILE))+max(::p2() and file(FILE))" or + hg log -r "max(::p1(REV) and file(FILE))+max(::p2(REV) and file(FILE))" See :hg:`summary` and :hg:`help revsets` for related information.