changeset 51276:03665fd8ccb9

narrow: strip trailing `/` from manifest dir before matching it Commit 17a822d7943e broke some of our internal tests at Google because the `dir` variable contains a trailing slash since that commit. Let's restore the old behavior by stripping that trailing slash.
author Martin von Zweigbergk <martinvonz@google.com>
date Sat, 16 Dec 2023 10:48:20 -0800
parents 39f7b2b53c68
children 6113221a1dea
files hgext/narrow/narrowcommands.py tests/test-narrow.t
diffstat 2 files changed, 2 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/narrow/narrowcommands.py	Mon Dec 18 10:13:41 2023 -0800
+++ b/hgext/narrow/narrowcommands.py	Sat Dec 16 10:48:20 2023 -0800
@@ -296,7 +296,7 @@
                     for file_ in entry.files():
                         todelete.append(file_.unencoded_path)
             elif entry.is_manifestlog:
-                dir = entry.target_id
+                dir = entry.target_id[:-1]
                 dirs = sorted(pathutil.dirs({dir})) + [dir]
                 include = True
                 for d in dirs:
--- a/tests/test-narrow.t	Mon Dec 18 10:13:41 2023 -0800
+++ b/tests/test-narrow.t	Sat Dec 16 10:48:20 2023 -0800
@@ -550,25 +550,11 @@
   $ hg clone --narrow ssh://user@dummy/master narrow-concurrent-modify -q \
   > --include rootfilesin:d0 --include rootfilesin:d1
   $ cd narrow-concurrent-modify
-#if flat
   $ hg --config 'hooks.pretxnopen = echo modified >> d0/f' tracked --removeinclude rootfilesin:d0
   comparing with ssh://user@dummy/master
   searching for changes
   looking for local changes to affected paths
   deleting data/d0/f.i
+  deleting meta/d0/00manifest.i (tree !)
   deleting unwanted files from working copy
   not deleting possibly dirty file d0/f
-#endif
-#if tree
-  $ hg --config 'hooks.pretxnopen = echo modified >> d0/f' tracked --removeinclude rootfilesin:d0
-  comparing with ssh://user@dummy/master
-  searching for changes
-  looking for local changes to affected paths
-  deleting data/d0/f.i
-  deleting meta/d0/00manifest.i
-  deleting meta/d1/00manifest.i (known-bad-output !)
-  deleting unwanted files from working copy
-  not deleting possibly dirty file d0/f
-  abort: meta/d1/00manifest@77a3e194be076ae47ba9282271028916012d815c: no node (known-bad-output !)
-  [50]
-#endif