mercurial/commands.py
changeset 46778 066b8d8f75b8
parent 46777 25850879a215
child 46794 e2f7b2695ba1
equal deleted inserted replaced
46777:25850879a215 46778:066b8d8f75b8
  5621             False,
  5621             False,
  5622             _(b'push the changeset as public (EXPERIMENTAL)'),
  5622             _(b'push the changeset as public (EXPERIMENTAL)'),
  5623         ),
  5623         ),
  5624     ]
  5624     ]
  5625     + remoteopts,
  5625     + remoteopts,
  5626     _(b'[-f] [-r REV]... [-e CMD] [--remotecmd CMD] [DEST]'),
  5626     _(b'[-f] [-r REV]... [-e CMD] [--remotecmd CMD] [DEST]...'),
  5627     helpcategory=command.CATEGORY_REMOTE_REPO_MANAGEMENT,
  5627     helpcategory=command.CATEGORY_REMOTE_REPO_MANAGEMENT,
  5628     helpbasic=True,
  5628     helpbasic=True,
  5629 )
  5629 )
  5630 def push(ui, repo, dest=None, **opts):
  5630 def push(ui, repo, *dests, **opts):
  5631     """push changes to the specified destination
  5631     """push changes to the specified destination
  5632 
  5632 
  5633     Push changesets from the local repository to the specified
  5633     Push changesets from the local repository to the specified
  5634     destination.
  5634     destination.
  5635 
  5635 
  5660     bookmark's name. Use the --all-bookmarks option for pushing all
  5660     bookmark's name. Use the --all-bookmarks option for pushing all
  5661     current bookmarks.
  5661     current bookmarks.
  5662 
  5662 
  5663     Please see :hg:`help urls` for important details about ``ssh://``
  5663     Please see :hg:`help urls` for important details about ``ssh://``
  5664     URLs. If DESTINATION is omitted, a default path will be used.
  5664     URLs. If DESTINATION is omitted, a default path will be used.
       
  5665 
       
  5666     When passed multiple destinations, push will process them one after the
       
  5667     other, but stop should an error occur.
  5665 
  5668 
  5666     .. container:: verbose
  5669     .. container:: verbose
  5667 
  5670 
  5668         The --pushvars option sends strings to the server that become
  5671         The --pushvars option sends strings to the server that become
  5669         environment variables prepended with ``HG_USERVAR_``. For example,
  5672         environment variables prepended with ``HG_USERVAR_``. For example,
  5704                 opts.setdefault(b'rev', []).append(b)
  5707                 opts.setdefault(b'rev', []).append(b)
  5705             else:
  5708             else:
  5706                 # if we try to push a deleted bookmark, translate it to null
  5709                 # if we try to push a deleted bookmark, translate it to null
  5707                 # this lets simultaneous -r, -b options continue working
  5710                 # this lets simultaneous -r, -b options continue working
  5708                 opts.setdefault(b'rev', []).append(b"null")
  5711                 opts.setdefault(b'rev', []).append(b"null")
  5709     if True:
  5712 
       
  5713     if not dests:
       
  5714         dests = [None]
       
  5715     some_pushed = False
       
  5716     result = 0
       
  5717     for dest in dests:
  5710         path = ui.getpath(dest, default=(b'default-push', b'default'))
  5718         path = ui.getpath(dest, default=(b'default-push', b'default'))
  5711         if not path:
  5719         if not path:
  5712             raise error.ConfigError(
  5720             raise error.ConfigError(
  5713                 _(b'default repository not configured!'),
  5721                 _(b'default repository not configured!'),
  5714                 hint=_(b"see 'hg help config.paths'"),
  5722                 hint=_(b"see 'hg help config.paths'"),
  5751             try:
  5759             try:
  5752                 # push subrepos depth-first for coherent ordering
  5760                 # push subrepos depth-first for coherent ordering
  5753                 c = repo[b'.']
  5761                 c = repo[b'.']
  5754                 subs = c.substate  # only repos that are committed
  5762                 subs = c.substate  # only repos that are committed
  5755                 for s in sorted(subs):
  5763                 for s in sorted(subs):
  5756                     result = c.sub(s).push(opts)
  5764                     sub_result = c.sub(s).push(opts)
  5757                     if result == 0:
  5765                     if sub_result == 0:
  5758                         return not result
  5766                         return 1
  5759             finally:
  5767             finally:
  5760                 del repo._subtoppath
  5768                 del repo._subtoppath
  5761 
  5769 
  5762             opargs = dict(
  5770             opargs = dict(
  5763                 opts.get(b'opargs', {})
  5771                 opts.get(b'opargs', {})
  5773                 bookmarks=opts.get(b'bookmark', ()),
  5781                 bookmarks=opts.get(b'bookmark', ()),
  5774                 publish=opts.get(b'publish'),
  5782                 publish=opts.get(b'publish'),
  5775                 opargs=opargs,
  5783                 opargs=opargs,
  5776             )
  5784             )
  5777 
  5785 
  5778             result = not pushop.cgresult
  5786             if pushop.cgresult == 0:
       
  5787                 result = 1
       
  5788             elif pushop.cgresult is not None:
       
  5789                 some_pushed = True
  5779 
  5790 
  5780             if pushop.bkresult is not None:
  5791             if pushop.bkresult is not None:
  5781                 if pushop.bkresult == 2:
  5792                 if pushop.bkresult == 2:
  5782                     result = 2
  5793                     result = 2
  5783                 elif not result and pushop.bkresult:
  5794                 elif not result and pushop.bkresult:
  5784                     result = 2
  5795                     result = 2
       
  5796 
       
  5797             if result:
       
  5798                 break
       
  5799 
  5785         finally:
  5800         finally:
  5786             other.close()
  5801             other.close()
       
  5802     if result == 0 and not some_pushed:
       
  5803         result = 1
  5787     return result
  5804     return result
  5788 
  5805 
  5789 
  5806 
  5790 @command(
  5807 @command(
  5791     b'recover',
  5808     b'recover',