mercurial/bookmarks.py
changeset 24397 d0ea2028e8e6
parent 24355 ca4b89683078
child 24398 c0096a2bd3ff
equal deleted inserted replaced
24396:9e03602cd2d8 24397:d0ea2028e8e6
   440         for b, node, writer, msg in sorted(changed):
   440         for b, node, writer, msg in sorted(changed):
   441             localmarks[b] = node
   441             localmarks[b] = node
   442             writer(msg)
   442             writer(msg)
   443         localmarks.recordchange(tr)
   443         localmarks.recordchange(tr)
   444 
   444 
       
   445 def incoming(ui, repo, other):
       
   446     '''Show bookmarks incoming from other to repo
       
   447     '''
       
   448     ui.status(_("searching for changed bookmarks\n"))
       
   449 
       
   450     r = compare(repo, other.listkeys('bookmarks'), repo._bookmarks,
       
   451                 dsthex=hex)
       
   452     addsrc, adddst, advsrc, advdst, diverge, differ, invalid, same = r
       
   453 
       
   454     incomings = []
       
   455     if ui.debugflag:
       
   456         getid = lambda id: id
       
   457     else:
       
   458         getid = lambda id: id[:12]
       
   459     def add(b, id):
       
   460         incomings.append("   %-25s %s\n" % (b, getid(id)))
       
   461     for b, scid, dcid in addsrc:
       
   462         add(b, scid)
       
   463 
       
   464     if not incomings:
       
   465         ui.status(_("no changed bookmarks found\n"))
       
   466         return 1
       
   467 
       
   468     for s in sorted(incomings):
       
   469         ui.write(s)
       
   470 
       
   471     return 0
       
   472 
   445 def diff(ui, dst, src):
   473 def diff(ui, dst, src):
   446     ui.status(_("searching for changed bookmarks\n"))
   474     ui.status(_("searching for changed bookmarks\n"))
   447 
   475 
   448     smarks = src.listkeys('bookmarks')
   476     smarks = src.listkeys('bookmarks')
   449     dmarks = dst.listkeys('bookmarks')
   477     dmarks = dst.listkeys('bookmarks')