hgext/largefiles/overrides.py
branchstable
changeset 15598 a77ce45584ef
parent 15576 e387e760b207
child 15626 931dc4af0d95
child 15663 9036c7d106bf
--- a/hgext/largefiles/overrides.py	Thu Dec 01 14:17:17 2011 +0100
+++ b/hgext/largefiles/overrides.py	Wed Nov 30 15:11:00 2011 +0100
@@ -373,7 +373,8 @@
                 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,18 +389,19 @@
 
             lfdirstate = lfutil.openlfdirstate(ui, repo)
             for (src, dest) in copiedfiles:
-                if lfutil.shortname in src and lfutil.shortname in dest:
-                    srclfile = src.replace(lfutil.shortname, '')
-                    destlfile = dest.replace(lfutil.shortname, '')
+                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 '.'
                     if not os.path.isdir(destlfiledir):
                         os.makedirs(destlfiledir)
                     if rename:
-                        os.rename(srclfile, destlfile)
-                        lfdirstate.remove(repo.wjoin(srclfile))
+                        os.rename(repo.wjoin(srclfile), repo.wjoin(destlfile))
+                        lfdirstate.remove(srclfile)
                     else:
                         util.copyfile(srclfile, destlfile)
-                    lfdirstate.add(repo.wjoin(destlfile))
+                    lfdirstate.add(destlfile)
             lfdirstate.write()
         except util.Abort, e:
             if str(e) != 'no files to copy':