Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/cmdutil.py @ 41604:4d4842445afc
revert: always show relative path to .orig backup
This helps make some future patches easier when I replace origpath()
by another function that works with repo-relative paths (origpath()
works with cwd-relative paths).
Always showing a relative path seems a little more user-friendly and
is more consistent between configured ui.origbackuppath and not. OTOH,
it's annoying if ui.origbackuppath is far outside the repo. This is
just --verbose output, so I don't think it's worth spending much time
on (I've already wasted too many hours on it).
Differential Revision: https://phab.mercurial-scm.org/D5871
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Wed, 06 Feb 2019 14:57:08 -0800 |
parents | 15f63ac122ea |
children | 9e545c9a4dfe |
comparison
equal
deleted
inserted
replaced
41603:349c8879becd | 41604:4d4842445afc |
---|---|
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.origpath(ui, repo, rel) |
3021 relbakname = os.path.relpath(bakname) | |
3021 ui.note(_('saving current version of %s as %s\n') % | 3022 ui.note(_('saving current version of %s as %s\n') % |
3022 (rel, bakname)) | 3023 (rel, relbakname)) |
3023 if not opts.get('dry_run'): | 3024 if not opts.get('dry_run'): |
3024 if interactive: | 3025 if interactive: |
3025 util.copyfile(target, bakname) | 3026 util.copyfile(target, bakname) |
3026 else: | 3027 else: |
3027 util.rename(target, bakname) | 3028 util.rename(target, bakname) |