##// END OF EJS Templates
push: indent the some part of the command...
marmoute -
r47535:25850879 default
parent child Browse files
Show More
@@ -5706,80 +5706,84 b' def push(ui, repo, dest=None, **opts):'
5706 5706 # if we try to push a deleted bookmark, translate it to null
5707 5707 # this lets simultaneous -r, -b options continue working
5708 5708 opts.setdefault(b'rev', []).append(b"null")
5709
5710 path = ui.getpath(dest, default=(b'default-push', b'default'))
5711 if not path:
5712 raise error.ConfigError(
5713 _(b'default repository not configured!'),
5714 hint=_(b"see 'hg help config.paths'"),
5715 )
5716 dest = path.pushloc or path.loc
5717 branches = (path.branch, opts.get(b'branch') or [])
5718 ui.status(_(b'pushing to %s\n') % util.hidepassword(dest))
5719 revs, checkout = hg.addbranchrevs(repo, repo, branches, opts.get(b'rev'))
5720 other = hg.peer(repo, opts, dest)
5721
5722 try:
5723 if revs:
5724 revs = [repo[r].node() for r in scmutil.revrange(repo, revs)]
5725 if not revs:
5726 raise error.InputError(
5727 _(b"specified revisions evaluate to an empty set"),
5728 hint=_(b"use different revision arguments"),
5729 )
5730 elif path.pushrev:
5731 # It doesn't make any sense to specify ancestor revisions. So limit
5732 # to DAG heads to make discovery simpler.
5733 expr = revsetlang.formatspec(b'heads(%r)', path.pushrev)
5734 revs = scmutil.revrange(repo, [expr])
5735 revs = [repo[rev].node() for rev in revs]
5736 if not revs:
5737 raise error.InputError(
5738 _(b'default push revset for path evaluates to an empty set')
5739 )
5740 elif ui.configbool(b'commands', b'push.require-revs'):
5741 raise error.InputError(
5742 _(b'no revisions specified to push'),
5743 hint=_(b'did you mean "hg push -r ."?'),
5709 if True:
5710 path = ui.getpath(dest, default=(b'default-push', b'default'))
5711 if not path:
5712 raise error.ConfigError(
5713 _(b'default repository not configured!'),
5714 hint=_(b"see 'hg help config.paths'"),
5744 5715 )
5745
5746 repo._subtoppath = dest
5716 dest = path.pushloc or path.loc
5717 branches = (path.branch, opts.get(b'branch') or [])
5718 ui.status(_(b'pushing to %s\n') % util.hidepassword(dest))
5719 revs, checkout = hg.addbranchrevs(
5720 repo, repo, branches, opts.get(b'rev')
5721 )
5722 other = hg.peer(repo, opts, dest)
5723
5747 5724 try:
5748 # push subrepos depth-first for coherent ordering
5749 c = repo[b'.']
5750 subs = c.substate # only repos that are committed
5751 for s in sorted(subs):
5752 result = c.sub(s).push(opts)
5753 if result == 0:
5754 return not result
5725 if revs:
5726 revs = [repo[r].node() for r in scmutil.revrange(repo, revs)]
5727 if not revs:
5728 raise error.InputError(
5729 _(b"specified revisions evaluate to an empty set"),
5730 hint=_(b"use different revision arguments"),
5731 )
5732 elif path.pushrev:
5733 # It doesn't make any sense to specify ancestor revisions. So limit
5734 # to DAG heads to make discovery simpler.
5735 expr = revsetlang.formatspec(b'heads(%r)', path.pushrev)
5736 revs = scmutil.revrange(repo, [expr])
5737 revs = [repo[rev].node() for rev in revs]
5738 if not revs:
5739 raise error.InputError(
5740 _(
5741 b'default push revset for path evaluates to an empty set'
5742 )
5743 )
5744 elif ui.configbool(b'commands', b'push.require-revs'):
5745 raise error.InputError(
5746 _(b'no revisions specified to push'),
5747 hint=_(b'did you mean "hg push -r ."?'),
5748 )
5749
5750 repo._subtoppath = dest
5751 try:
5752 # push subrepos depth-first for coherent ordering
5753 c = repo[b'.']
5754 subs = c.substate # only repos that are committed
5755 for s in sorted(subs):
5756 result = c.sub(s).push(opts)
5757 if result == 0:
5758 return not result
5759 finally:
5760 del repo._subtoppath
5761
5762 opargs = dict(
5763 opts.get(b'opargs', {})
5764 ) # copy opargs since we may mutate it
5765 opargs.setdefault(b'pushvars', []).extend(opts.get(b'pushvars', []))
5766
5767 pushop = exchange.push(
5768 repo,
5769 other,
5770 opts.get(b'force'),
5771 revs=revs,
5772 newbranch=opts.get(b'new_branch'),
5773 bookmarks=opts.get(b'bookmark', ()),
5774 publish=opts.get(b'publish'),
5775 opargs=opargs,
5776 )
5777
5778 result = not pushop.cgresult
5779
5780 if pushop.bkresult is not None:
5781 if pushop.bkresult == 2:
5782 result = 2
5783 elif not result and pushop.bkresult:
5784 result = 2
5755 5785 finally:
5756 del repo._subtoppath
5757
5758 opargs = dict(
5759 opts.get(b'opargs', {})
5760 ) # copy opargs since we may mutate it
5761 opargs.setdefault(b'pushvars', []).extend(opts.get(b'pushvars', []))
5762
5763 pushop = exchange.push(
5764 repo,
5765 other,
5766 opts.get(b'force'),
5767 revs=revs,
5768 newbranch=opts.get(b'new_branch'),
5769 bookmarks=opts.get(b'bookmark', ()),
5770 publish=opts.get(b'publish'),
5771 opargs=opargs,
5772 )
5773
5774 result = not pushop.cgresult
5775
5776 if pushop.bkresult is not None:
5777 if pushop.bkresult == 2:
5778 result = 2
5779 elif not result and pushop.bkresult:
5780 result = 2
5781 finally:
5782 other.close()
5786 other.close()
5783 5787 return result
5784 5788
5785 5789
General Comments 0
You need to be logged in to leave comments. Login now