rebase: fix path auditing to audit path relative to repo root (issue5818) stable 4.8.1
authorMartin von Zweigbergk <martinvonz@google.com>
Tue, 20 Nov 2018 14:43:27 -0800
branchstable
changeset 53582 1c8c54cf97256f4468da2eb4dbee24f7f3888e71
parent 53581 d10b1dc134316c13c637232fc52389aa24319e12
child 53583 ee948f23bf2e73701c82deafce27197f99be5aac
push id1079
push usergszorc@mozilla.com
push dateMon, 10 Dec 2018 19:44:59 +0000
rebase: fix path auditing to audit path relative to repo root (issue5818) Before this patch, when rebasing a file called "foo/bar", we would check e.g. if "/foo" (i.e. rooted at the file system root) was a symlink. Differential Revision: https://phab.mercurial-scm.org/D5361
mercurial/context.py
tests/test-rebase-inmemory.t
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -1843,18 +1843,18 @@ class overlayworkingctx(committablectx):
         # is not a file in p1.
         components = path.split('/')
         for i in pycompat.xrange(len(components)):
             component = "/".join(components[0:i])
             if component in self:
                 fail(path, component)
 
         # Test the other direction -- that this path from p2 isn't a directory
-        # in p1 (test that p1 doesn't any paths matching `path/*`).
-        match = matchmod.match('/', '', [path + '/'], default=b'relpath')
+        # in p1 (test that p1 doesn't have any paths matching `path/*`).
+        match = self.match(pats=[path + '/'], default=b'path')
         matches = self.p1().manifest().matches(match)
         mfiles = matches.keys()
         if len(mfiles) > 0:
             if len(mfiles) == 1 and mfiles[0] == path:
                 return
             # omit the files which are deleted in current IMM wctx
             mfiles = [m for m in mfiles if m in self]
             if not mfiles:
--- a/tests/test-rebase-inmemory.t
+++ b/tests/test-rebase-inmemory.t
@@ -274,18 +274,17 @@ Test path auditing (issue5818)
 
   $ hg up -q '.^'
   $ touch ".$TESTTMP/lib/c"
   $ hg add ".$TESTTMP/lib/c"
   $ hg ci -m 'c'
   created new head
   $ hg rebase -s 1 -d .
   rebasing 1:* "b" (glob)
-  abort: path '*/lib/b' traverses symbolic link '*/lib' (glob)
-  [255]
+  saved backup bundle to $TESTTMP/repo/.hg/strip-backup/*-rebase.hg (glob)
   $ cd ..
 
 Test dry-run rebasing
 
   $ hg init repo3
   $ cd repo3
   $ echo a>a
   $ hg ci -Aqma