changeset 40461:1c8c54cf9725 stable 4.8.1

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
author Martin von Zweigbergk <martinvonz@google.com>
date Tue, 20 Nov 2018 14:43:27 -0800
parents d10b1dc13431
children ee948f23bf2e
files mercurial/context.py tests/test-rebase-inmemory.t
diffstat 2 files changed, 3 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/context.py	Tue Dec 04 08:56:43 2018 -0800
+++ b/mercurial/context.py	Tue Nov 20 14:43:27 2018 -0800
@@ -1848,8 +1848,8 @@
                 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:
--- a/tests/test-rebase-inmemory.t	Tue Dec 04 08:56:43 2018 -0800
+++ b/tests/test-rebase-inmemory.t	Tue Nov 20 14:43:27 2018 -0800
@@ -279,8 +279,7 @@
   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