mercurial/bookmarks.py
changeset 16706 a270ec977ba6
parent 16697 c285aae10f6c
child 16719 e7bf09acd410
equal deleted inserted replaced
16705:c2d9ef43ff6c 16706:a270ec977ba6
   148             raise util.Abort(_("branch %s not found") % curbranch)
   148             raise util.Abort(_("branch %s not found") % curbranch)
   149 
   149 
   150 def update(repo, parents, node):
   150 def update(repo, parents, node):
   151     marks = repo._bookmarks
   151     marks = repo._bookmarks
   152     update = False
   152     update = False
   153     mark = repo._bookmarkcurrent
   153     cur = repo._bookmarkcurrent
   154     if mark and marks[mark] in parents:
   154     if not cur:
   155         old = repo[marks[mark]]
   155         return False
   156         new = repo[node]
   156 
   157         if new in old.descendants():
   157     toupdate = [b for b in marks if b.split('@', 1)[0] == cur.split('@', 1)[0]]
   158             marks[mark] = new.node()
   158     for mark in toupdate:
   159             update = True
   159         if mark and marks[mark] in parents:
       
   160             old = repo[marks[mark]]
       
   161             new = repo[node]
       
   162             if new in old.descendants() and mark == cur:
       
   163                 marks[cur] = new.node()
       
   164                 update = True
       
   165             if mark != cur:
       
   166                 del marks[mark]
   160     if update:
   167     if update:
   161         repo._writebookmarks(marks)
   168         repo._writebookmarks(marks)
   162     return update
   169     return update
   163 
   170 
   164 def listbookmarks(repo):
   171 def listbookmarks(repo):