[Bug 4691] New: Inconsistent interpretation of rev 0 parent

mercurial-bugs at selenic.com mercurial-bugs at selenic.com
Fri May 29 00:34:04 UTC 2015


http://bz.selenic.com/show_bug.cgi?id=4691

          Priority: normal
            Bug ID: 4691
                CC: mercurial-devel at selenic.com
          Assignee: bugzilla at selenic.com
           Summary: Inconsistent interpretation of rev 0 parent
          Severity: bug
    Classification: Unclassified
                OS: All
          Reporter: matt_harbison at yahoo.com
          Hardware: PC
            Status: UNCONFIRMED
           Version: default branch
         Component: Mercurial
           Product: Mercurial

Some revsets for the parent of 0 behave as expected, others don't:

$ ../hg log -r "0~1"
changeset:   -1:000000000000
user:
date:        Thu Jan 01 00:00:00 1970 +0000

$ ../hg log -r "0^"

$ ../hg log -r "0^1"
changeset:   -1:000000000000
user:
date:        Thu Jan 01 00:00:00 1970 +0000

$ ../hg log -r "p1(0)"

$ ../hg log -r "parents(rev(0))"

$ ../hg log -r "rev(-1)"     # NB: a raw -1 == tip
changeset:   -1:000000000000
user:
date:        Thu Jan 01 00:00:00 1970 +0000

Logging rev -1 is pretty silly, but I found this with a script that walks from
0..N, exporting diffs that would be imported into a new repo.  The script used
the 'hg diff --rev "$rev^" --rev "$rev"' form, which outputs nothing for 0:

$ ../hg diff --rev 0^ --rev 0


This might be a clue about what is going on:

$ ../hg files --rev 0^
abort: empty revision set

I chased it into revset.match(), where the 'spec' parameter is still '0^', and
'parse(spec, lookup)' is returning a tree that prints as "('parentpost',
('symbol', '0'))".  Commenting out "ps -= set([node.nullrev])" in p1() had no
effect for 'files', but does change the 'diff' output.


Not sure if this discussion is relevant:

http://markmail.org/thread/pklgeuv42axp2xdq

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the Mercurial-devel mailing list