comparison mercurial/commands.py @ 2476:0f7e4a39d9af

archive: make "hg archive -t XXX -" to write to stdout
author Vadim Gelfer <vadim.gelfer@gmail.com>
date Wed, 21 Jun 2006 15:15:06 -0700
parents 30c267cb4c2f
children 818ebebc4554
comparison
equal deleted inserted replaced
2475:7a77934ece46 2476:0f7e4a39d9af
778 if p2 != nullid: 778 if p2 != nullid:
779 raise util.Abort(_('uncommitted merge - please provide a ' 779 raise util.Abort(_('uncommitted merge - please provide a '
780 'specific revision')) 780 'specific revision'))
781 781
782 dest = make_filename(repo, repo.changelog, dest, node) 782 dest = make_filename(repo, repo.changelog, dest, node)
783 prefix = make_filename(repo, repo.changelog, opts['prefix'], node)
784 if os.path.realpath(dest) == repo.root: 783 if os.path.realpath(dest) == repo.root:
785 raise util.Abort(_('repository root cannot be destination')) 784 raise util.Abort(_('repository root cannot be destination'))
786 dummy, matchfn, dummy = matchpats(repo, [], opts) 785 dummy, matchfn, dummy = matchpats(repo, [], opts)
787 archival.archive(repo, dest, node, opts.get('type') or 'files', 786 kind = opts.get('type') or 'files'
788 not opts['no_decode'], matchfn, prefix) 787 prefix = opts['prefix']
788 if dest == '-':
789 if kind == 'files':
790 raise util.Abort(_('cannot archive plain files to stdout'))
791 dest = sys.stdout
792 if not prefix: prefix = os.path.basename(repo.root) + '-%h'
793 prefix = make_filename(repo, repo.changelog, prefix, node)
794 archival.archive(repo, dest, node, kind, not opts['no_decode'],
795 matchfn, prefix)
789 796
790 def backout(ui, repo, rev, **opts): 797 def backout(ui, repo, rev, **opts):
791 '''reverse effect of earlier changeset 798 '''reverse effect of earlier changeset
792 799
793 Commit the backed out changes as a new changeset. The new 800 Commit the backed out changes as a new changeset. The new