comparison 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
comparison
equal deleted inserted replaced
4852:cba10652a901 4853:6dc0094c0827
140 Each member added to an archive file has a directory prefix 140 Each member added to an archive file has a directory prefix
141 prepended. Use "-p" to specify a format string for the prefix. 141 prepended. Use "-p" to specify a format string for the prefix.
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'))
149 dummy, matchfn, dummy = cmdutil.matchpats(repo, [], opts) 152 dummy, matchfn, dummy = cmdutil.matchpats(repo, [], opts)
150 kind = opts.get('type') or 'files' 153 kind = opts.get('type') or 'files'