comparison mercurial/cmdutil.py @ 41597:9e545c9a4dfe

revert: migrate to scmutil.backuppath() Differential Revision: https://phab.mercurial-scm.org/D5853
author Martin von Zweigbergk <martinvonz@google.com>
date Tue, 05 Feb 2019 11:14:07 -0800
parents 4d4842445afc
children 7068c6b0114b
comparison
equal deleted inserted replaced
41596:630af04d4ae4 41597:9e545c9a4dfe
3015 # If in interactive mode, don't automatically create 3015 # If in interactive mode, don't automatically create
3016 # .orig files (issue4793) 3016 # .orig files (issue4793)
3017 if dobackup == backupinteractive: 3017 if dobackup == backupinteractive:
3018 tobackup.add(abs) 3018 tobackup.add(abs)
3019 elif (backup <= dobackup or wctx[abs].cmp(ctx[abs])): 3019 elif (backup <= dobackup or wctx[abs].cmp(ctx[abs])):
3020 bakname = scmutil.origpath(ui, repo, rel) 3020 bakname = scmutil.backuppath(ui, repo, abs)
3021 relbakname = os.path.relpath(bakname) 3021 relbakname = os.path.relpath(bakname)
3022 ui.note(_('saving current version of %s as %s\n') % 3022 ui.note(_('saving current version of %s as %s\n') %
3023 (rel, relbakname)) 3023 (rel, relbakname))
3024 if not opts.get('dry_run'): 3024 if not opts.get('dry_run'):
3025 if interactive: 3025 if interactive:
3168 if ishunk(c): 3168 if ishunk(c):
3169 abs = c.header.filename() 3169 abs = c.header.filename()
3170 # Create a backup file only if this hunk should be backed up 3170 # Create a backup file only if this hunk should be backed up
3171 if c.header.filename() in tobackup: 3171 if c.header.filename() in tobackup:
3172 target = repo.wjoin(abs) 3172 target = repo.wjoin(abs)
3173 bakname = scmutil.origpath(repo.ui, repo, m.rel(abs)) 3173 bakname = scmutil.backuppath(repo.ui, repo, abs)
3174 util.copyfile(target, bakname) 3174 util.copyfile(target, bakname)
3175 tobackup.remove(abs) 3175 tobackup.remove(abs)
3176 c.write(fp) 3176 c.write(fp)
3177 dopatch = fp.tell() 3177 dopatch = fp.tell()
3178 fp.seek(0) 3178 fp.seek(0)