Mercurial > hg
comparison mercurial/bookmarks.py @ 33483:146c0371eadf
bookmark: use 'applychanges' for adding new bookmark
author | Boris Feld <boris.feld@octobus.net> |
---|---|
date | Mon, 10 Jul 2017 17:10:56 +0200 |
parents | 916d4cde530e |
children | 2a8ce4e79a47 |
comparison
equal
deleted
inserted
replaced
33482:916d4cde530e | 33483:146c0371eadf |
---|---|
756 Raises an abort error if old is not in the bookmark store. | 756 Raises an abort error if old is not in the bookmark store. |
757 """ | 757 """ |
758 marks = repo._bookmarks | 758 marks = repo._bookmarks |
759 cur = repo.changectx('.').node() | 759 cur = repo.changectx('.').node() |
760 newact = None | 760 newact = None |
761 changes = [] | |
761 for mark in names: | 762 for mark in names: |
762 mark = checkformat(repo, mark) | 763 mark = checkformat(repo, mark) |
763 if newact is None: | 764 if newact is None: |
764 newact = mark | 765 newact = mark |
765 if inactive and mark == repo._activebookmark: | 766 if inactive and mark == repo._activebookmark: |
767 return | 768 return |
768 tgt = cur | 769 tgt = cur |
769 if rev: | 770 if rev: |
770 tgt = scmutil.revsingle(repo, rev).node() | 771 tgt = scmutil.revsingle(repo, rev).node() |
771 marks.checkconflict(mark, force, tgt) | 772 marks.checkconflict(mark, force, tgt) |
772 marks[mark] = tgt | 773 changes.append((mark, tgt)) |
774 marks.applychanges(repo, tr, changes) | |
773 if not inactive and cur == marks[newact] and not rev: | 775 if not inactive and cur == marks[newact] and not rev: |
774 activate(repo, newact) | 776 activate(repo, newact) |
775 elif cur != tgt and newact == repo._activebookmark: | 777 elif cur != tgt and newact == repo._activebookmark: |
776 deactivate(repo) | 778 deactivate(repo) |
777 marks.recordchange(tr) | |
778 | 779 |
779 def _printbookmarks(ui, repo, bmarks, **opts): | 780 def _printbookmarks(ui, repo, bmarks, **opts): |
780 """private method to print bookmarks | 781 """private method to print bookmarks |
781 | 782 |
782 Provides a way for extensions to control how bookmarks are printed (e.g. | 783 Provides a way for extensions to control how bookmarks are printed (e.g. |