Patchwork [4,of,5] linkrev: also adjust linkrev when bootstrapping 'follow' revset

login
register
mail settings
Submitter Pierre-Yves David
Date Dec. 30, 2014, 9:37 p.m.
Message ID <3c1794146af6ada845c1.1419975431@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/7267/
State Accepted
Commit c624fb2c42392e14d336e3196d956677a3e2a385
Headers show

Comments

Pierre-Yves David - Dec. 30, 2014, 9:37 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@fb.com>
# Date 1419925224 28800
#      Mon Dec 29 23:40:24 2014 -0800
# Node ID 3c1794146af6ada845c1b62bfd061edc020d9be7
# Parent  e64b95ee52529397007da14ab71110a8d6a2f1c0
linkrev: also adjust linkrev when bootstrapping 'follow' revset

The follow revset (used by `hg log --follow`) now use the new 'introrev'
method to bootstrap its traversal. This catch issues from linkrev-shadowing of
the changesets introducing the version of a file in source changeset.

More test have been added to display pathological cases.

Another test is affected because it was meant to test this behavior but actually
failed to do so for half of the output. The output are now similar.

Patch

diff --git a/mercurial/revset.py b/mercurial/revset.py
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -805,11 +805,11 @@  def _follow(repo, subset, x, name, follo
         x = getstring(l[0], _("%s expected a filename") % name)
         if x in c:
             cx = c[x]
             s = set(ctx.rev() for ctx in cx.ancestors(followfirst=followfirst))
             # include the revision responsible for the most recent version
-            s.add(cx.linkrev())
+            s.add(cx.introrev())
         else:
             return baseset()
     else:
         s = _revancestors(repo, baseset([c.rev()]), followfirst)
 
diff --git a/tests/test-log.t b/tests/test-log.t
--- a/tests/test-log.t
+++ b/tests/test-log.t
@@ -1557,11 +1557,11 @@  hg log -f dir across branches
   @  c
   |
   o  a
   
   $ hg log -f d/a -T '{desc}' -G
-  o  b
+  @  c
   |
   o  a
   
   $ cd ..
 
@@ -1654,6 +1654,23 @@  plain log list the original version
   o  changeset:   0:ae0a3c9f9e95
      user:        test
      date:        Thu Jan 01 00:00:00 1970 +0000
      summary:     content1
   
+
+hg log -f from the grafted changeset
+(The bootstrap should properly take the topology in account)
+
+  $ hg up 'desc(content3)^'
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg log -Gf a
+  @  changeset:   3:15b2327059e5
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     content2
+  |
+  o  changeset:   0:ae0a3c9f9e95
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     content1
+  
   $ cd ..