changeset 5128:c9126c24e098

record: work properly if invoked in a subdirectory
author Bryan O'Sullivan <bos@serpentine.com>
date Mon, 06 Aug 2007 12:53:17 -0700
parents 90be02035993
children eca5b31cffc7
files hgext/record.py tests/test-record tests/test-record.out
diffstat 3 files changed, 33 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/record.py	Mon Aug 06 20:31:15 2007 +0200
+++ b/hgext/record.py	Mon Aug 06 12:53:17 2007 -0700
@@ -363,7 +363,7 @@
             try:
                 for realname, tmpname in backups.iteritems():
                     ui.debug('restoring %r to %r\n' % (tmpname, realname))
-                    util.copyfile(tmpname, realname)
+                    util.copyfile(tmpname, repo.wjoin(realname))
                     os.unlink(tmpname)
                 os.rmdir(backupdir)
             except OSError:
--- a/tests/test-record	Mon Aug 06 20:31:15 2007 +0200
+++ b/tests/test-record	Mon Aug 06 12:53:17 2007 -0700
@@ -202,3 +202,15 @@
 y
 EOF
 echo; hg tip -p
+
+mkdir subdir
+cd subdir
+echo a > a
+hg ci -d '16 0' -Amsubdir
+
+echo a >> a
+hg record -d '16 0' -m subdir-change a <<EOF
+y
+y
+EOF
+echo; hg tip -p
--- a/tests/test-record.out	Mon Aug 06 20:31:15 2007 +0200
+++ b/tests/test-record.out	Mon Aug 06 12:53:17 2007 -0700
@@ -381,3 +381,23 @@
 +10
 +11
 
+adding subdir/a
+diff --git a/subdir/a b/subdir/a
+1 hunks, 1 lines changed
+record changes to 'subdir/a'? [y]es [n]o @@ -1,1 +1,2 @@ a
+ a
++a
+record this change to 'subdir/a'? [y]es [n]o 
+changeset:   18:33ff5c4fb017
+tag:         tip
+user:        test
+date:        Thu Jan 01 00:00:16 1970 +0000
+summary:     subdir-change
+
+diff -r aecf2b2ea83c -r 33ff5c4fb017 subdir/a
+--- a/subdir/a	Thu Jan 01 00:00:16 1970 +0000
++++ b/subdir/a	Thu Jan 01 00:00:16 1970 +0000
+@@ -1,1 +1,2 @@ a
+ a
++a
+