##// END OF EJS Templates
archive: abort on empty repository. Fixes #624.
Brendan Cully -
r4863:6dc0094c default
parent child Browse files
Show More
@@ -142,7 +142,10 b' def archive(ui, repo, dest, **opts):'
142 The default is the basename of the archive, with suffixes removed.
142 The default is the basename of the archive, with suffixes removed.
143 '''
143 '''
144
144
145 node = repo.changectx(opts['rev']).node()
145 ctx = repo.changectx(opts['rev'])
146 if not ctx:
147 raise util.Abort(_('repository has no revisions'))
148 node = ctx.node()
146 dest = cmdutil.make_filename(repo, dest, node)
149 dest = cmdutil.make_filename(repo, dest, node)
147 if os.path.realpath(dest) == repo.root:
150 if os.path.realpath(dest) == repo.root:
148 raise util.Abort(_('repository root cannot be destination'))
151 raise util.Abort(_('repository root cannot be destination'))
@@ -63,3 +63,9 b' hg archive -t zip -r 2 test.zip'
63 unzip -t test.zip
63 unzip -t test.zip
64
64
65 hg archive -t tar - | tar tf - | sed "s/$QTIP/TIP/"
65 hg archive -t tar - | tar tf - | sed "s/$QTIP/TIP/"
66
67 echo '% empty repo'
68 hg init ../empty
69 cd ../empty
70 hg archive ../test-empty
71 exit 0 No newline at end of file
@@ -38,3 +38,5 b' test-TIP/.hg_archival.txt'
38 test-TIP/bar
38 test-TIP/bar
39 test-TIP/baz/bletch
39 test-TIP/baz/bletch
40 test-TIP/foo
40 test-TIP/foo
41 % empty repo
42 abort: repository has no revisions
General Comments 0
You need to be logged in to leave comments. Login now