changeset 5101: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
+++ b/hgext/record.py
@@ -363,7 +363,7 @@ def record(ui, repo, *pats, **opts):
             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
+++ b/tests/test-record
@@ -202,3 +202,15 @@ y
 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
+++ b/tests/test-record.out
@@ -381,3 +381,23 @@ diff -r c1c639d8b268 -r 80b74bbc7808 pla
 +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
+