[PATCH] largefiles: be sure not to mangle all files that happen to have lfutil.shortname in the name

Na'Tosha Bard natosha at unity3d.com
Wed Nov 30 08:46:11 CST 2011


# HG changeset patch
# User Na'Tosha Bard <natosha at unity3d.com>
# Date 1322662871 -3600
# Node ID 37b9e1c23d6faa5b2ba8ffabbcc2d900914e9b68
# Parent  82e1271340561c1e966eaf555deba80d7f5d083a
largefiles: be sure not to mangle all files that happen to have lfutil.shortname in the name

diff -r 82e127134056 -r 37b9e1c23d6f hgext/largefiles/overrides.py
--- a/hgext/largefiles/overrides.py	Wed Nov 30 15:11:21 2011 +0100
+++ b/hgext/largefiles/overrides.py	Wed Nov 30 15:21:11 2011 +0100
@@ -373,7 +373,7 @@
                 origcopyfile = util.copyfile
                 copiedfiles = []
                 def override_copyfile(src, dest):
-                    if lfutil.shortname in src and lfutil.shortname in dest:
+                    if lfutil.shortname in src and dest.startswith(repo.wjoin(lfutil.shortname)):
                         destlfile = dest.replace(lfutil.shortname, '')
                         if not opts['force'] and os.path.exists(destlfile):
                             raise IOError('',
@@ -388,7 +388,7 @@
 
             lfdirstate = lfutil.openlfdirstate(ui, repo)
             for (src, dest) in copiedfiles:
-                if lfutil.shortname in src and lfutil.shortname in dest:
+                if lfutil.shortname in src and dest.startswith(repo.wjoin(lfutil.shortname)):
                     srclfile = src.replace(repo.wjoin(lfutil.standin('')), '')
                     destlfile = dest.replace(repo.wjoin(lfutil.standin('')), '')
                     destlfiledir = os.path.dirname(destlfile) or '.'


More information about the Mercurial-devel mailing list