# HG changeset patch # User Dan Villiom Podlaski Christiansen <danchr@gmail.com> # Date 1625845717 -7200 # Fri Jul 09 17:48:37 2021 +0200 # Node ID d4b7380435c63607e771a00872dd685df0911447 # Parent 0db597e185a18fda06f49a3cfc74ab105434e21c core: detect divergence with a branch bookmark suffix diff --git a/hggit/git_handler.py b/hggit/git_handler.py --- a/hggit/git_handler.py +++ b/hggit/git_handler.py @@ -1647,17 +1647,16 @@ try: bms = self.repo._bookmarks - suffix = self.branch_bookmark_suffix or b'' changes = [] for head, hgsha in self._get_heads(refs).items(): - if head not in bms: + bm = head + (self.branch_bookmark_suffix or b'') + + if bm not in bms: # new branch - changes.append((head + suffix, hgsha)) - else: - bm = self.repo[bms[head]] - if bm.ancestor(self.repo[hgsha]) == bm: - # fast forward - changes.append((head + suffix, hgsha)) + changes.append((bm, hgsha)) + elif self.repo[bms[bm]].isancestorof(self.repo[hgsha]): + # fast forward + changes.append((bm, hgsha)) if changes: with self.repo.wlock(), self.repo.lock(): diff --git a/tests/test-branch-bookmark-suffix.t b/tests/test-branch-bookmark-suffix.t --- a/tests/test-branch-bookmark-suffix.t +++ b/tests/test-branch-bookmark-suffix.t @@ -243,7 +243,6 @@ (run 'hg update' to get a working copy) $ hg log --graph o changeset: 5:895d0307f8b7 - | bookmark: branch1_bookmark | tag: default/branch1 (with-path !) | tag: tip | user: test <test@example.org> @@ -272,7 +271,8 @@ | summary: add f2 | | o changeset: 1:8211cade99e4 - |/ user: test <test@example.org> + |/ bookmark: branch1_bookmark + | user: test <test@example.org> | date: Mon Jan 01 00:00:12 2007 +0000 | summary: append f1 |