mercurial/commands.py
changeset 5061 a49f2a4d5ff7
parent 4966 8d982aef0be1
child 5062 0f594cc36aed
child 5067 3d35c8cb5eb4
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -133,7 +133,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'))