changeset 4524:6c58139f4eaa

Use absolute paths in revert.
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
date Fri, 08 Jun 2007 23:49:12 -0300
parents b9d311928caf
children 78b6add1f966
files mercurial/commands.py
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -2293,16 +2293,17 @@ def revert(ui, repo, *pats, **opts):
 
     for abs, (rel, exact) in entries:
         mfentry = mf.get(abs)
+        target = repo.wjoin(abs)
         def handle(xlist, dobackup):
             xlist[0].append(abs)
             update[abs] = 1
             if (dobackup and not opts['no_backup'] and
-                (os.path.islink(rel) or os.path.exists(rel))):
+                (os.path.islink(target) or os.path.exists(target))):
                 bakname = "%s.orig" % rel
                 ui.note(_('saving current version of %s as %s\n') %
                         (rel, bakname))
                 if not opts.get('dry_run'):
-                    util.copyfile(rel, bakname)
+                    util.copyfile(target, bakname)
             if ui.verbose or not exact:
                 ui.status(xlist[1] % rel)
         for table, hitlist, misslist, backuphit, backupmiss in disptable: