diff mercurial/commands.py @ 4853:6dc0094c0827

archive: abort on empty repository. Fixes #624.
author Brendan Cully <brendan@kublai.com>
date Tue, 10 Jul 2007 10:06:24 -0700
parents f3802f9f1840
children 192cd95c2ba8
line wrap: on
line diff
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -142,7 +142,10 @@ def archive(ui, repo, dest, **opts):
     The default is the basename of the archive, with suffixes removed.
     '''
 
-    node = repo.changectx(opts['rev']).node()
+    ctx = repo.changectx(opts['rev'])
+    if not ctx:
+        raise util.Abort(_('repository has no revisions'))
+    node = ctx.node()
     dest = cmdutil.make_filename(repo, dest, node)
     if os.path.realpath(dest) == repo.root:
         raise util.Abort(_('repository root cannot be destination'))