hgext/largefiles/overrides.py
branchstable
changeset 15323 19368c54a774
parent 15306 94527d67f3da
child 15369 b4ea79f88268
equal deleted inserted replaced
15322:c8e2a5ea7062 15323:19368c54a774
   296         # this isn't legal, let the original function deal with it
   296         # this isn't legal, let the original function deal with it
   297         return orig(ui, repo, pats, opts, rename)
   297         return orig(ui, repo, pats, opts, rename)
   298 
   298 
   299     def makestandin(relpath):
   299     def makestandin(relpath):
   300         path = scmutil.canonpath(repo.root, repo.getcwd(), relpath)
   300         path = scmutil.canonpath(repo.root, repo.getcwd(), relpath)
   301         return os.path.join(os.path.relpath('.', repo.getcwd()),
   301         return os.path.join(repo.wjoin(lfutil.standin(path)))
   302             lfutil.standin(path))
       
   303 
   302 
   304     fullpats = scmutil.expandpats(pats)
   303     fullpats = scmutil.expandpats(pats)
   305     dest = fullpats[-1]
   304     dest = fullpats[-1]
   306 
   305 
   307     if os.path.isdir(dest):
   306     if os.path.isdir(dest):
   395                     destlfiledir = os.path.dirname(destlfile) or '.'
   394                     destlfiledir = os.path.dirname(destlfile) or '.'
   396                     if not os.path.isdir(destlfiledir):
   395                     if not os.path.isdir(destlfiledir):
   397                         os.makedirs(destlfiledir)
   396                         os.makedirs(destlfiledir)
   398                     if rename:
   397                     if rename:
   399                         os.rename(srclfile, destlfile)
   398                         os.rename(srclfile, destlfile)
   400                         lfdirstate.remove(os.path.relpath(srclfile,
   399                         lfdirstate.remove(repo.wjoin(srclfile))
   401                             repo.root))
       
   402                     else:
   400                     else:
   403                         util.copyfile(srclfile, destlfile)
   401                         util.copyfile(srclfile, destlfile)
   404                     lfdirstate.add(os.path.relpath(destlfile,
   402                     lfdirstate.add(repo.wjoin(destlfile))
   405                         repo.root))
       
   406             lfdirstate.write()
   403             lfdirstate.write()
   407         except util.Abort, e:
   404         except util.Abort, e:
   408             if str(e) != 'no files to copy':
   405             if str(e) != 'no files to copy':
   409                 raise e
   406                 raise e
   410             else:
   407             else: