diff --git a/hgext3rd/smartlog.py b/hgext3rd/smartlog.py --- a/hgext3rd/smartlog.py +++ b/hgext3rd/smartlog.py @@ -457,7 +457,6 @@ heads = set() rev = repo.changelog.rev - branchinfo = repo.changelog.branchinfo ancestor = repo.changelog.ancestor node = repo.changelog.node parentrevs = repo.changelog.parentrevs @@ -482,13 +481,13 @@ heads.update(repo.revs('.')) global hiddenchanges - headquery = 'head() & branch(.)' + headquery = 'head()' if remotebooks: # When we have remote bookmarks, only show draft heads, since public # heads should have a remote bookmark indicating them. This allows us # to force push server bookmarks to new locations, and not have the # commits clutter the user's smartlog. - headquery = 'heads(draft()) & branch(.)' + headquery = 'heads(draft())' allheads = set(repo.revs(headquery)) if recentdays >= 0: @@ -500,69 +499,36 @@ else: heads.update(allheads) - branches = set() - for head in heads: - branches.add(branchinfo(head)[0]) - masterrevset = _masterrevset(repo.ui, repo, masterstring) masterrev = _masterrev(repo, masterrevset) if masterrev is None: - masterbranch = None - else: - masterbranch = branchinfo(masterrev)[0] + masterrev = repo['tip'].rev() - for branch in branches: - if branch != masterbranch: - try: - rs = 'first(reverse(branch("%s")) & public())' % branch - branchmaster = repo.revs(rs).first() - if branchmaster is None: - # local-only (draft) branch - rs = 'branch("%s")' % branch - branchmaster = repo.revs(rs).first() - except Exception: - branchmaster = repo.revs('tip').first() - else: - branchmaster = masterrev + masternode = node(masterrev) - # Find all draft ancestors and latest public ancestor of heads - # that are not in master. - # We don't want to draw all public commits because there can be too - # many of them. - # Don't use revsets, they are too slow - for head in heads: - if branchinfo(head)[0] != branch: - continue - anc = rev(ancestor(node(head), node(branchmaster))) - queue = [head] - while queue: - current = queue.pop(0) - if current not in revs: - revs.add(current) - # stop as soon as we find public commit - ispublic = repo[current].phase() == phases.public - if current != anc and not ispublic: - parents = parentrevs(current) - for p in parents: - if p > anc: - queue.append(p) + # Find all draft ancestors and latest public ancestor of heads + # that are not in master. + # We don't want to draw all public commits because there can be too + # many of them. + # Don't use revsets, they are too slow + for head in heads: + anc = rev(ancestor(node(head), masternode)) + queue = [head] + while queue: + current = queue.pop(0) + if current not in revs: + revs.add(current) + # stop as soon as we find public commit + ispublic = repo[current].phase() == phases.public + if current != anc and not ispublic: + parents = parentrevs(current) + for p in parents: + if p > anc: + queue.append(p) - # add context: master, current commit, and the common ancestor - revs.add(branchmaster) - - # get common branch ancestor - if branch != masterbranch: - anc = None - for r in revs: - if branchinfo(r)[0] != branch: - continue - if anc is None: - anc = r - else: - anc = rev(ancestor(node(anc), node(r))) - if anc: - revs.add(anc) + # add context: master, current commit, and the common ancestor + revs.add(masterrev) return subset & revs diff --git a/tests/test-smartlog-inhibit.t b/tests/test-smartlog-inhibit.t --- a/tests/test-smartlog-inhibit.t +++ b/tests/test-smartlog-inhibit.t @@ -39,5 +39,4 @@ | o 1 59cf2bc6d22f.preamend | - o 0 - + ~ diff --git a/tests/test-smartlog.t b/tests/test-smartlog.t --- a/tests/test-smartlog.t +++ b/tests/test-smartlog.t @@ -233,45 +233,12 @@ | a2 | -Test draft branches - - $ hg branch foo - marked working directory as branch foo - (branches are permanent and global, did you want a bookmark?) - $ hg commit -m 'create branch foo' - $ hg sl - @ changeset: 6:26d4a421c339 - | branch: foo - | bookmark: feature2 - | tag: tip - | user: test - | date: Thu Jan 01 00:00:00 1970 +0000 - . summary: create branch foo - . - o changeset: 4:38d85b506754 - | bookmark: master - | user: test - | date: Thu Jan 01 00:00:00 1970 +0000 - . summary: c2 - . - | o changeset: 2:49cdb4091aca - |/ bookmark: feature1 - | user: test - | date: Thu Jan 01 00:00:00 1970 +0000 - | summary: b - | - o changeset: 1:b68836a6e2ca - | user: test - | date: Thu Jan 01 00:00:00 1970 +0000 - | summary: a2 - | - Test with weird bookmark names $ hg book -r 2 foo-bar $ hg smartlog -r 'foo-bar + .' -T compact - @ 6[tip][feature2] 26d4a421c339 1970-01-01 00:00 +0000 test - . create branch foo + @ 5[tip][feature2] 05d10250273e 1970-01-01 00:00 +0000 test + . d . | o 2[feature1,foo-bar] 49cdb4091aca 1970-01-01 00:00 +0000 test |/ b @@ -283,9 +250,9 @@ o 2[feature1,foo-bar] 49cdb4091aca 1970-01-01 00:00 +0000 test | b | - | @ 6[tip][feature2] 26d4a421c339 1970-01-01 00:00 +0000 test - | . create branch foo - | . + | @ 5[tip][feature2] 05d10250273e 1970-01-01 00:00 +0000 test + | | d + | | | o 4[master] 38d85b506754 1970-01-01 00:00 +0000 test | | c2 | | @@ -308,15 +275,15 @@ $ touch u2 && hg add u2 && hg ci -mu2 $ hg smartlog -T compact - @ 8[tip] 806aaef35296 1970-01-01 00:00 +0000 test + @ 7[tip] 806aaef35296 1970-01-01 00:00 +0000 test | u2 | - o 7:-1 8749dc393678 1970-01-01 00:00 +0000 test + o 6:-1 8749dc393678 1970-01-01 00:00 +0000 test u1 - o 6[feature2] 26d4a421c339 1970-01-01 00:00 +0000 test - . create branch foo - . + o 5[feature2] 05d10250273e 1970-01-01 00:00 +0000 test + | d + | o 4[master] 38d85b506754 1970-01-01 00:00 +0000 test . c2 . @@ -326,11 +293,6 @@ o 1 b68836a6e2ca 1970-01-01 00:00 +0000 test | a2 | - note: hiding 1 old heads without bookmarks - (use --all to see them) - - $ hg update 26d4a421c339 - 5 files updated, 0 files merged, 2 files removed, 0 files unresolved Test singlepublicsuccessor template keyword $ echo "[extensions]" >> $HGRCPATH