--- a/hgext/convert/hg.py
+++ b/hgext/convert/hg.py
@@ -134,7 +134,10 @@ class mercurial_source(converter_source)
return self.lastctx
def getheads(self):
- return [hex(node) for node in self.repo.heads()]
+ if self.rev:
+ return [hex(self.repo.changectx(self.rev).node())]
+ else:
+ return [hex(node) for node in self.repo.heads()]
def getfile(self, name, rev):
try:
--- a/hgext/convert/subversion.py
+++ b/hgext/convert/subversion.py
@@ -102,7 +102,7 @@ class convert_svn(converter_source):
try:
latest = int(rev)
except ValueError:
- raise util.Abort('svn: revision %s is not an integer' % rev)
+ raise NoRepo('svn: revision %s is not an integer' % rev)
try:
# Support file://path@rev syntax. Useful e.g. to convert
# deleted branches.
--- a/hgext/record.py
+++ b/hgext/record.py
@@ -327,8 +327,8 @@ def record(ui, repo, *pats, **opts):
try:
os.mkdir(backupdir)
except OSError, err:
- if err.errno == errno.EEXIST:
- pass
+ if err.errno != errno.EEXIST:
+ raise
try:
for f in newfiles:
if f not in modified:
@@ -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
+