mercurial/exchange.py
changeset 22239 0688010ee38f
parent 22238 c894fdff56d1
child 22240 d092f4b68fb6
equal deleted inserted replaced
22238:c894fdff56d1 22239:0688010ee38f
    81         self.outdatedphases = None
    81         self.outdatedphases = None
    82         # phases changes that must be pushed if changeset push fails
    82         # phases changes that must be pushed if changeset push fails
    83         self.fallbackoutdatedphases = None
    83         self.fallbackoutdatedphases = None
    84         # outgoing obsmarkers
    84         # outgoing obsmarkers
    85         self.outobsmarkers = set()
    85         self.outobsmarkers = set()
       
    86         # outgoing bookmarks
       
    87         self.outbookmarks = []
    86 
    88 
    87     @util.propertycache
    89     @util.propertycache
    88     def futureheads(self):
    90     def futureheads(self):
    89         """future remote heads if the changeset push succeeds"""
    91         """future remote heads if the changeset push succeeds"""
    90         return self.outgoing.missingheads
    92         return self.outgoing.missingheads
   278 
   280 
   279 @pushdiscovery('obsmarker')
   281 @pushdiscovery('obsmarker')
   280 def _pushdiscoveryobsmarkers(pushop):
   282 def _pushdiscoveryobsmarkers(pushop):
   281     pushop.outobsmarkers = pushop.repo.obsstore
   283     pushop.outobsmarkers = pushop.repo.obsstore
   282 
   284 
       
   285 @pushdiscovery('bookmarks')
       
   286 def _pushdiscoverybookmarks(pushop):
       
   287     ui = pushop.ui
       
   288     repo = pushop.repo.unfiltered()
       
   289     remote = pushop.remote
       
   290     ui.debug("checking for updated bookmarks\n")
       
   291     ancestors = ()
       
   292     if pushop.revs:
       
   293         revnums = map(repo.changelog.rev, pushop.revs)
       
   294         ancestors = repo.changelog.ancestors(revnums, inclusive=True)
       
   295     remotebookmark = remote.listkeys('bookmarks')
       
   296 
       
   297     comp = bookmarks.compare(repo, repo._bookmarks, remotebookmark, srchex=hex)
       
   298     (addsrc, adddst, advsrc, advdst, diverge, differ, invalid) = comp
       
   299     for b, scid, dcid in advsrc:
       
   300         if not ancestors or repo[scid].rev() in ancestors:
       
   301             pushop.outbookmarks.append((b, dcid, scid))
       
   302 
   283 def _pushcheckoutgoing(pushop):
   303 def _pushcheckoutgoing(pushop):
   284     outgoing = pushop.outgoing
   304     outgoing = pushop.outgoing
   285     unfi = pushop.repo.unfiltered()
   305     unfi = pushop.repo.unfiltered()
   286     if not outgoing.missing:
   306     if not outgoing.missing:
   287         # nothing to push
   307         # nothing to push
   614 def _pushbookmark(pushop):
   634 def _pushbookmark(pushop):
   615     """Update bookmark position on remote"""
   635     """Update bookmark position on remote"""
   616     if pushop.ret == 0:
   636     if pushop.ret == 0:
   617         return
   637         return
   618     ui = pushop.ui
   638     ui = pushop.ui
   619     repo = pushop.repo.unfiltered()
       
   620     remote = pushop.remote
   639     remote = pushop.remote
   621     ui.debug("checking for updated bookmarks\n")
   640     for b, old, new in pushop.outbookmarks:
   622     ancestors = ()
   641         if remote.pushkey('bookmarks', b, old, new):
   623     if pushop.revs:
       
   624         revnums = map(repo.changelog.rev, pushop.revs)
       
   625         ancestors = repo.changelog.ancestors(revnums, inclusive=True)
       
   626     remotebookmark = remote.listkeys('bookmarks')
       
   627     comp = bookmarks.compare(repo, repo._bookmarks, remotebookmark, srchex=hex)
       
   628     (addsrc, adddst, advsrc, advdst, diverge, differ, invalid) = comp
       
   629     for b, scid, dcid in advsrc:
       
   630         if ancestors and repo[scid].rev() not in ancestors:
       
   631             continue
       
   632         if remote.pushkey('bookmarks', b, dcid, scid):
       
   633             ui.status(_("updating bookmark %s\n") % b)
   642             ui.status(_("updating bookmark %s\n") % b)
   634         else:
   643         else:
   635             ui.warn(_('updating bookmark %s failed!\n') % b)
   644             ui.warn(_('updating bookmark %s failed!\n') % b)
   636 
   645 
   637 class pulloperation(object):
   646 class pulloperation(object):