185 |
185 |
186 ctx = cmdutil.revsingle(repo, opts.get('rev')) |
186 ctx = cmdutil.revsingle(repo, opts.get('rev')) |
187 if not ctx: |
187 if not ctx: |
188 raise util.Abort(_('no working directory: please specify a revision')) |
188 raise util.Abort(_('no working directory: please specify a revision')) |
189 node = ctx.node() |
189 node = ctx.node() |
190 dest = cmdutil.make_filename(repo, dest, node) |
190 dest = cmdutil.makefilename(repo, dest, node) |
191 if os.path.realpath(dest) == repo.root: |
191 if os.path.realpath(dest) == repo.root: |
192 raise util.Abort(_('repository root cannot be destination')) |
192 raise util.Abort(_('repository root cannot be destination')) |
193 |
193 |
194 kind = opts.get('type') or archival.guesskind(dest) or 'files' |
194 kind = opts.get('type') or archival.guesskind(dest) or 'files' |
195 prefix = opts.get('prefix') |
195 prefix = opts.get('prefix') |
199 raise util.Abort(_('cannot archive plain files to stdout')) |
199 raise util.Abort(_('cannot archive plain files to stdout')) |
200 dest = sys.stdout |
200 dest = sys.stdout |
201 if not prefix: |
201 if not prefix: |
202 prefix = os.path.basename(repo.root) + '-%h' |
202 prefix = os.path.basename(repo.root) + '-%h' |
203 |
203 |
204 prefix = cmdutil.make_filename(repo, prefix, node) |
204 prefix = cmdutil.makefilename(repo, prefix, node) |
205 matchfn = cmdutil.match(repo, [], opts) |
205 matchfn = cmdutil.match(repo, [], opts) |
206 archival.archive(repo, dest, node, kind, not opts.get('no_decode'), |
206 archival.archive(repo, dest, node, kind, not opts.get('no_decode'), |
207 matchfn, prefix, subrepos=opts.get('subrepos')) |
207 matchfn, prefix, subrepos=opts.get('subrepos')) |
208 |
208 |
209 def backout(ui, repo, node=None, rev=None, **opts): |
209 def backout(ui, repo, node=None, rev=None, **opts): |