mercurial/discovery.py
changeset 45942 89a2afe31e82
parent 45908 122f0b59f5f0
child 46119 9261f6c1d39b
equal deleted inserted replaced
45941:346af7687c6f 45942:89a2afe31e82
    73         anyinc = any(not has_node(n) for n in heads)
    73         anyinc = any(not has_node(n) for n in heads)
    74     return (list(common), anyinc, heads or list(srvheads))
    74     return (list(common), anyinc, heads or list(srvheads))
    75 
    75 
    76 
    76 
    77 class outgoing(object):
    77 class outgoing(object):
    78     '''Represents the result of a findcommonoutgoing() call.
    78     """Represents the result of a findcommonoutgoing() call.
    79 
    79 
    80     Members:
    80     Members:
    81 
    81 
    82       ancestorsof is a list of the nodes whose ancestors are included in the
    82       ancestorsof is a list of the nodes whose ancestors are included in the
    83       outgoing operation.
    83       outgoing operation.
    92 
    92 
    93       excluded is the list of missing changeset that shouldn't be sent
    93       excluded is the list of missing changeset that shouldn't be sent
    94       remotely.
    94       remotely.
    95 
    95 
    96     Some members are computed on demand from the heads, unless provided upfront
    96     Some members are computed on demand from the heads, unless provided upfront
    97     by discovery.'''
    97     by discovery."""
    98 
    98 
    99     def __init__(
    99     def __init__(
   100         self, repo, commonheads=None, ancestorsof=None, missingroots=None
   100         self, repo, commonheads=None, ancestorsof=None, missingroots=None
   101     ):
   101     ):
   102         # at least one of them must not be set
   102         # at least one of them must not be set
   155 
   155 
   156 
   156 
   157 def findcommonoutgoing(
   157 def findcommonoutgoing(
   158     repo, other, onlyheads=None, force=False, commoninc=None, portable=False
   158     repo, other, onlyheads=None, force=False, commoninc=None, portable=False
   159 ):
   159 ):
   160     '''Return an outgoing instance to identify the nodes present in repo but
   160     """Return an outgoing instance to identify the nodes present in repo but
   161     not in other.
   161     not in other.
   162 
   162 
   163     If onlyheads is given, only nodes ancestral to nodes in onlyheads
   163     If onlyheads is given, only nodes ancestral to nodes in onlyheads
   164     (inclusive) are included. If you already know the local repo's heads,
   164     (inclusive) are included. If you already know the local repo's heads,
   165     passing them in onlyheads is faster than letting them be recomputed here.
   165     passing them in onlyheads is faster than letting them be recomputed here.
   166 
   166 
   167     If commoninc is given, it must be the result of a prior call to
   167     If commoninc is given, it must be the result of a prior call to
   168     findcommonincoming(repo, other, force) to avoid recomputing it here.
   168     findcommonincoming(repo, other, force) to avoid recomputing it here.
   169 
   169 
   170     If portable is given, compute more conservative common and ancestorsof,
   170     If portable is given, compute more conservative common and ancestorsof,
   171     to make bundles created from the instance more portable.'''
   171     to make bundles created from the instance more portable."""
   172     # declare an empty outgoing object to be filled later
   172     # declare an empty outgoing object to be filled later
   173     og = outgoing(repo, None, None)
   173     og = outgoing(repo, None, None)
   174 
   174 
   175     # get common set if not provided
   175     # get common set if not provided
   176     if commoninc is None:
   176     if commoninc is None:
   330     remote = pushop.remote
   330     remote = pushop.remote
   331     localbookmarks = repo._bookmarks
   331     localbookmarks = repo._bookmarks
   332 
   332 
   333     with remote.commandexecutor() as e:
   333     with remote.commandexecutor() as e:
   334         remotebookmarks = e.callcommand(
   334         remotebookmarks = e.callcommand(
   335             b'listkeys', {b'namespace': b'bookmarks',}
   335             b'listkeys',
       
   336             {
       
   337                 b'namespace': b'bookmarks',
       
   338             },
   336         ).result()
   339         ).result()
   337 
   340 
   338     bookmarkedheads = set()
   341     bookmarkedheads = set()
   339 
   342 
   340     # internal config: bookmarks.pushing
   343     # internal config: bookmarks.pushing
   468         if dhs:
   471         if dhs:
   469             if errormsg is None:
   472             if errormsg is None:
   470                 if branch not in (b'default', None):
   473                 if branch not in (b'default', None):
   471                     errormsg = _(
   474                     errormsg = _(
   472                         b"push creates new remote head %s on branch '%s'"
   475                         b"push creates new remote head %s on branch '%s'"
   473                     ) % (short(dhs[0]), branch,)
   476                     ) % (
       
   477                         short(dhs[0]),
       
   478                         branch,
       
   479                     )
   474                 elif repo[dhs[0]].bookmarks():
   480                 elif repo[dhs[0]].bookmarks():
   475                     errormsg = _(
   481                     errormsg = _(
   476                         b"push creates new remote head %s "
   482                         b"push creates new remote head %s "
   477                         b"with bookmark '%s'"
   483                         b"with bookmark '%s'"
   478                     ) % (short(dhs[0]), repo[dhs[0]].bookmarks()[0])
   484                     ) % (short(dhs[0]), repo[dhs[0]].bookmarks()[0])