##// END OF EJS Templates
archive: abort on empty repository. Fixes #624.
Brendan Cully -
r5061:a49f2a4d default
parent child Browse files
Show More
@@ -133,7 +133,10 b' def archive(ui, repo, dest, **opts):'
133 The default is the basename of the archive, with suffixes removed.
133 The default is the basename of the archive, with suffixes removed.
134 '''
134 '''
135
135
136 node = repo.changectx(opts['rev']).node()
136 ctx = repo.changectx(opts['rev'])
137 if not ctx:
138 raise util.Abort(_('repository has no revisions'))
139 node = ctx.node()
137 dest = cmdutil.make_filename(repo, dest, node)
140 dest = cmdutil.make_filename(repo, dest, node)
138 if os.path.realpath(dest) == repo.root:
141 if os.path.realpath(dest) == repo.root:
139 raise util.Abort(_('repository root cannot be destination'))
142 raise util.Abort(_('repository root cannot be destination'))
@@ -67,3 +67,9 b' hg archive -r 0 -t tar rev-%r.tar'
67 if [ -f rev-0.tar ]; then
67 if [ -f rev-0.tar ]; then
68 echo 'rev-0.tar created'
68 echo 'rev-0.tar created'
69 fi
69 fi
70
71 echo '% empty repo'
72 hg init ../empty
73 cd ../empty
74 hg archive ../test-empty
75 exit 0
@@ -39,3 +39,5 b' test-TIP/bar'
39 test-TIP/baz/bletch
39 test-TIP/baz/bletch
40 test-TIP/foo
40 test-TIP/foo
41 rev-0.tar created
41 rev-0.tar created
42 % empty repo
43 abort: repository has no revisions
General Comments 0
You need to be logged in to leave comments. Login now