D5853: revert: migrate to scmutil.backuppath()
martinvonz created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5853 AFFECTED FILES mercurial/cmdutil.py CHANGE DETAILS diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -2999,8 +2999,6 @@ ) for abs, (rel, exact) in sorted(names.items()): -# target file to be touch on disk (relative to cwd) -target = repo.wjoin(abs) # search the entry in the dispatch table. # if the file is in any of these sets, it was touched in the working # directory parent and we are sure it needs to be reverted. @@ -3015,14 +3013,15 @@ if dobackup == backupinteractive: tobackup.add(abs) elif (backup <= dobackup or wctx[abs].cmp(ctx[abs])): -bakname = scmutil.origpath(ui, repo, rel) +bakname = scmutil.backuppath(ui, repo, abs) ui.note(_('saving current version of %s as %s\n') % (rel, bakname)) if not opts.get('dry_run'): +target = repo.wjoin(abs) if interactive: -util.copyfile(target, bakname) +util.copyfile(target, repo.wjoin(bakname)) else: -util.rename(target, bakname) +util.rename(target, repo.wjoin(bakname)) if opts.get('dry_run'): if ui.verbose or not exact: ui.status(msg % rel) @@ -3165,8 +3164,8 @@ # Create a backup file only if this hunk should be backed up if c.header.filename() in tobackup: target = repo.wjoin(abs) -bakname = scmutil.origpath(repo.ui, repo, m.rel(abs)) -util.copyfile(target, bakname) +bakname = scmutil.backuppath(repo.ui, repo, abs) +util.copyfile(target, repo.wjoin(bakname)) tobackup.remove(abs) c.write(fp) dopatch = fp.tell() To: martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5853: revert: migrate to scmutil.backuppath()
martinvonz added inline comments. INLINE COMMENTS > cmdutil.py:3017-3018 > +bakname = scmutil.backuppath(ui, repo, abs) > ui.note(_('saving current version of %s as > %s\n') % > (rel, bakname)) > if not opts.get('dry_run'): Sorry, there is a regression here: if you're in a subdirectory, this used to say "saving current version of foo as foo.orig", but now it will say "saving current version of foo as dir/foo.orig". So please don't queue this yet. I'll need to insert some patches earlier in the series. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5853 To: martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5853: revert: migrate to scmutil.backuppath()
martinvonz updated this revision to Diff 13858. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5853?vs=13817&id=13858 REVISION DETAIL https://phab.mercurial-scm.org/D5853 AFFECTED FILES mercurial/cmdutil.py CHANGE DETAILS diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -3017,7 +3017,7 @@ if dobackup == backupinteractive: tobackup.add(abs) elif (backup <= dobackup or wctx[abs].cmp(ctx[abs])): -bakname = scmutil.origpath(ui, repo, rel) +bakname = scmutil.backuppath(ui, repo, abs) relbakname = os.path.relpath(bakname) ui.note(_('saving current version of %s as %s\n') % (rel, relbakname)) @@ -3170,7 +3170,7 @@ # Create a backup file only if this hunk should be backed up if c.header.filename() in tobackup: target = repo.wjoin(abs) -bakname = scmutil.origpath(repo.ui, repo, m.rel(abs)) +bakname = scmutil.backuppath(repo.ui, repo, abs) util.copyfile(target, bakname) tobackup.remove(abs) c.write(fp) To: martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5853: revert: migrate to scmutil.backuppath()
martinvonz planned changes to this revision. martinvonz marked an inline comment as done. martinvonz added inline comments. INLINE COMMENTS > martinvonz wrote in cmdutil.py:3017-3018 > Sorry, there is a regression here: if you're in a subdirectory, this used to > say "saving current version of foo as foo.orig", but now it will say "saving > current version of foo as dir/foo.orig". So please don't queue this yet. I'll > need to insert some patches earlier in the series. This is now ready for review again. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D5853 To: martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D5853: revert: migrate to scmutil.backuppath()
This revision was automatically updated to reflect the committed changes. Closed by commit rHG9e545c9a4dfe: revert: migrate to scmutil.backuppath() (authored by martinvonz, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D5853?vs=13858&id=13875 REVISION DETAIL https://phab.mercurial-scm.org/D5853 AFFECTED FILES mercurial/cmdutil.py CHANGE DETAILS diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -3017,7 +3017,7 @@ if dobackup == backupinteractive: tobackup.add(abs) elif (backup <= dobackup or wctx[abs].cmp(ctx[abs])): -bakname = scmutil.origpath(ui, repo, rel) +bakname = scmutil.backuppath(ui, repo, abs) relbakname = os.path.relpath(bakname) ui.note(_('saving current version of %s as %s\n') % (rel, relbakname)) @@ -3170,7 +3170,7 @@ # Create a backup file only if this hunk should be backed up if c.header.filename() in tobackup: target = repo.wjoin(abs) -bakname = scmutil.origpath(repo.ui, repo, m.rel(abs)) +bakname = scmutil.backuppath(repo.ui, repo, abs) util.copyfile(target, bakname) tobackup.remove(abs) c.write(fp) To: martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel