[PATCH STABLE] largefiles: fix addremove with -R option

Matt Harbison matt_harbison at yahoo.com
Thu Jul 19 08:44:22 CDT 2012


# HG changeset patch
# User Matt Harbison <matt_harbison at yahoo.com>
# Date 1342693859 14400
# Branch stable
# Node ID 400c29ec67d481ebbbaca91f347f2046a1d6a4f0
# Parent  436cc9d017c68a3b71ec6bcb4ab0046a403c9045
largefiles: fix addremove with -R option

If a file was missing, the missing list contained a path relative to the repo.
When building the matcher from that list, the file name ended up concatenated to
cwd, causing the command to abort with '<file> not under root'.  This rebuilds
the missing list with paths relative to cwd.

diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py
--- a/hgext/largefiles/overrides.py
+++ b/hgext/largefiles/overrides.py
@@ -1001,8 +1001,9 @@
     # we don't remove the standin in the largefiles code, preventing a very
     # confused state later.
     if missing:
+        m = [repo.wjoin(f) for f in missing]
         repo._isaddremove = True
-        removelargefiles(ui, repo, *missing, **opts)
+        removelargefiles(ui, repo, *m, **opts)
         repo._isaddremove = False
     # Call into the normal add code, and any files that *should* be added as
     # largefiles will be
diff --git a/tests/test-largefiles.t b/tests/test-largefiles.t
--- a/tests/test-largefiles.t
+++ b/tests/test-largefiles.t
@@ -370,6 +370,25 @@
   removing normal3
   adding normaladdremove
 
+Test addremove with -R
+
+  $ hg up -C
+  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  getting changed largefiles
+  1 largefiles updated, 0 removed
+  $ rm normal3
+  $ rm sub/large4
+  $ echo "testing addremove with patterns" > testaddremove.dat
+  $ echo "normaladdremove" > normaladdremove
+  $ cd ..
+  $ hg -R a addremove
+  removing sub/large4
+  adding a/.hglf/testaddremove.dat as a largefile (glob)
+  adding a/testaddremove.dat as a largefile (glob)
+  removing normal3
+  adding normaladdremove
+  $ cd a
+
 Clone a largefiles repo.
 
   $ hg clone . ../b


More information about the Mercurial-devel mailing list