Mercurial > hg
comparison hgext/largefiles/overrides.py @ 37088:08890706366e
copyfile: preserve stat info (mtime, etc.) when doing copies/renames
Differential Revision: https://phab.mercurial-scm.org/D2729
author | Kyle Lippincott <spectral@google.com> |
---|---|
date | Thu, 08 Mar 2018 11:44:03 -0800 |
parents | 45bfcd16f27e |
children | 335e19c6b7fa |
comparison
equal
deleted
inserted
replaced
37087:e4640ec346ac | 37088:08890706366e |
---|---|
665 listpats.append(makestandin(pat)) | 665 listpats.append(makestandin(pat)) |
666 | 666 |
667 try: | 667 try: |
668 origcopyfile = util.copyfile | 668 origcopyfile = util.copyfile |
669 copiedfiles = [] | 669 copiedfiles = [] |
670 def overridecopyfile(src, dest): | 670 def overridecopyfile(src, dest, *args, **kwargs): |
671 if (lfutil.shortname in src and | 671 if (lfutil.shortname in src and |
672 dest.startswith(repo.wjoin(lfutil.shortname))): | 672 dest.startswith(repo.wjoin(lfutil.shortname))): |
673 destlfile = dest.replace(lfutil.shortname, '') | 673 destlfile = dest.replace(lfutil.shortname, '') |
674 if not opts['force'] and os.path.exists(destlfile): | 674 if not opts['force'] and os.path.exists(destlfile): |
675 raise IOError('', | 675 raise IOError('', |
676 _('destination largefile already exists')) | 676 _('destination largefile already exists')) |
677 copiedfiles.append((src, dest)) | 677 copiedfiles.append((src, dest)) |
678 origcopyfile(src, dest) | 678 origcopyfile(src, dest, *args, **kwargs) |
679 | 679 |
680 util.copyfile = overridecopyfile | 680 util.copyfile = overridecopyfile |
681 result += orig(ui, repo, listpats, opts, rename) | 681 result += orig(ui, repo, listpats, opts, rename) |
682 finally: | 682 finally: |
683 util.copyfile = origcopyfile | 683 util.copyfile = origcopyfile |