hgext3rd/topic/discovery.py
branchmercurial-4.8
changeset 4356 a71f2271ed76
parent 4263 35130e428ebd
child 4540 22cde12d9467
equal deleted inserted replaced
4355:75db6a9d0b54 4356:a71f2271ed76
    31         return orig(pushop, *args, **kwargs)
    31         return orig(pushop, *args, **kwargs)
    32 
    32 
    33     publishedset = ()
    33     publishedset = ()
    34     remotebranchmap = None
    34     remotebranchmap = None
    35     origremotebranchmap = remote.branchmap
    35     origremotebranchmap = remote.branchmap
    36     # < hg-4.4 do not have a --publish flag anyway
    36     publishednode = [c.node() for c in pushop.outdatedphases]
    37     if util.safehasattr(pushop, 'remotephases'):
    37     publishedset = repo.revs('ancestors(%ln + %ln)',
    38         publishednode = [c.node() for c in pushop.outdatedphases]
    38                              publishednode,
    39         publishedset = repo.revs('ancestors(%ln + %ln)',
    39                              pushop.remotephases.publicheads)
    40                                  publishednode,
    40 
    41                                  pushop.remotephases.publicheads)
    41     rev = repo.unfiltered().changelog.nodemap.get
    42 
    42 
    43         rev = repo.unfiltered().changelog.nodemap.get
    43     def remotebranchmap():
    44 
    44         # drop topic information from changeset about to be published
    45         def remotebranchmap():
    45         result = collections.defaultdict(list)
    46             # drop topic information from changeset about to be published
    46         for branch, heads in origremotebranchmap().iteritems():
    47             result = collections.defaultdict(list)
    47             if ':' not in branch:
    48             for branch, heads in origremotebranchmap().iteritems():
    48                 result[branch].extend(heads)
    49                 if ':' not in branch:
    49             else:
    50                     result[branch].extend(heads)
    50                 namedbranch = branch.split(':', 1)[0]
    51                 else:
    51                 for h in heads:
    52                     namedbranch = branch.split(':', 1)[0]
    52                     r = rev(h)
    53                     for h in heads:
    53                     if r is not None and r in publishedset:
    54                         r = rev(h)
    54                         result[namedbranch].append(h)
    55                         if r is not None and r in publishedset:
    55                     else:
    56                             result[namedbranch].append(h)
    56                         result[branch].append(h)
    57                         else:
    57         for heads in result.itervalues():
    58                             result[branch].append(h)
    58             heads.sort()
    59             for heads in result.itervalues():
    59         return result
    60                 heads.sort()
       
    61             return result
       
    62 
    60 
    63     class repocls(repo.__class__):
    61     class repocls(repo.__class__):
    64         # awful hack to see branch as "branch:topic"
    62         # awful hack to see branch as "branch:topic"
    65         def __getitem__(self, key):
    63         def __getitem__(self, key):
    66             ctx = super(repocls, self).__getitem__(key)
    64             ctx = super(repocls, self).__getitem__(key)