[Bug 5609] New: revsingle behavior changed

mercurial-bugs at mercurial-scm.org mercurial-bugs at mercurial-scm.org
Tue Jun 27 13:54:24 UTC 2017


https://bz.mercurial-scm.org/show_bug.cgi?id=5609

            Bug ID: 5609
           Summary: revsingle behavior changed
           Product: Mercurial
           Version: default branch
          Hardware: PC
                OS: Linux
            Status: UNCONFIRMED
          Severity: bug
          Priority: wish
         Component: revset
          Assignee: bugzilla at mercurial-scm.org
          Reporter: lothiraldan at gmail.com
                CC: mercurial-devel at mercurial-scm.org

The behavior of scmutil.revsingle seems to have changed in default branch.

Here is a reproduction scenario using annotate:

Setup:
    hg init test
    cd test
    touch ROOT
    hg commit -A -m ROOT
    echo "A" > A
    hg commit -A -m "A"

Repro:
    hg annotate -r "0::" A

The expected output is:
    1: A

The current output is:
    abort: A: no such file in rev c19fb0feaa37

Not all commands using revsingle seems affected.

I've bisected the problem to d83b189aef83 ( dagop: change revdescendants() to
include all root revisions).

I tried debugging the issue by printing "l.last()" value in revsingle:

    diff -r d83b189aef83 mercurial/scmutil.py
    --- a/mercurial/scmutil.py      Tue Jun 20 22:26:52 2017 +0900
    +++ b/mercurial/scmutil.py      Tue Jun 27 15:43:25 2017 +0200
    @@ -404,6 +404,7 @@
         l = revrange(repo, [revspec])
         if not l:
             raise error.Abort(_('empty revision set'))
    +    print("Last", l.last())
         return repo[l.last()]

     def _pairspec(revspec):

But after adding the print, the reproduction script stops failing. Even
stranger, printing "l.last()" value several times shows that the incorrect
value is only here the first time:

    diff -r d83b189aef83 mercurial/scmutil.py
    --- a/mercurial/scmutil.py      Tue Jun 20 22:26:52 2017 +0900
    +++ b/mercurial/scmutil.py      Tue Jun 27 15:45:22 2017 +0200
    @@ -404,6 +404,9 @@
         l = revrange(repo, [revspec])
         if not l:
             raise error.Abort(_('empty revision set'))
    +    print("Last", l.last())
    +    print("Last", l.last())
    +    print("Last", l.last())
         return repo[l.last()]

     def _pairspec(revspec):

And here is the annotate call:

    ('Last', 0)
    ('Last', 1)
    ('Last', 1)
    1: A

Here is the reproduction script as a .t file:

  $ hg init test
  $ cd test
  $ touch ROOT
  $ hg commit -A -m ROOT
  adding ROOT
  $ echo "A" > A
  $ hg commit -A -m "A"
  adding A
  $ hg annotate -r "0::" A
  1: A

(fails with the example at the top)

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


More information about the Mercurial-devel mailing list