diff -Nru mercurial-4.3.2~trusty1/debian/changelog mercurial-4.3.3~trusty1/debian/changelog --- mercurial-4.3.2~trusty1/debian/changelog 2017-10-01 10:03:18.000000000 +0000 +++ mercurial-4.3.3~trusty1/debian/changelog 2017-10-01 10:03:18.000000000 +0000 @@ -1,5 +1,5 @@ -mercurial (4.3.2~trusty1) trusty; urgency=medium +mercurial (4.3.3~trusty1) trusty; urgency=medium * Automated build performed by upstream. - -- Mercurial Devel Mon, 18 Sep 2017 16:01:13 +0000 + -- Mercurial Devel Sun, 01 Oct 2017 10:01:31 +0000 diff -Nru mercurial-4.3.2~trusty1/.hg_archival.txt mercurial-4.3.3~trusty1/.hg_archival.txt --- mercurial-4.3.2~trusty1/.hg_archival.txt 2017-09-18 15:51:41.000000000 +0000 +++ mercurial-4.3.3~trusty1/.hg_archival.txt 2017-09-18 17:54:00.000000000 +0000 @@ -1,4 +1,4 @@ repo: 9117c6561b0bd7792fa13b50d28239d51b78e51f -node: 920977f72c7b70acfdaf56ab35360584d7845827 +node: 2f427b57bf9019c6dc3750baa539dc22c1be50f6 branch: stable -tag: 4.3.2 +tag: 4.3.3 diff -Nru mercurial-4.3.2~trusty1/hgext/rebase.py mercurial-4.3.3~trusty1/hgext/rebase.py --- mercurial-4.3.2~trusty1/hgext/rebase.py 2017-09-18 15:51:41.000000000 +0000 +++ mercurial-4.3.3~trusty1/hgext/rebase.py 2017-09-18 17:54:00.000000000 +0000 @@ -508,12 +508,12 @@ ui.note(_("update back to initial working directory parent\n")) hg.updaterepo(repo, newwd, False) + collapsedas = None if not self.keepf: - collapsedas = None if self.collapsef: collapsedas = newnode - clearrebased(ui, repo, self.dest, self.state, self.skipped, - collapsedas) + clearrebased(ui, repo, self.dest, self.state, self.skipped, + collapsedas, self.keepf) clearstatus(repo) clearcollapsemsg(repo) @@ -1354,32 +1354,30 @@ state[r] = revprecursor return originalwd, dest.rev(), state -def clearrebased(ui, repo, dest, state, skipped, collapsedas=None): +def clearrebased(ui, repo, dest, state, skipped, collapsedas=None, keepf=False): """dispose of rebased revision at the end of the rebase If `collapsedas` is not None, the rebase was a collapse whose result if the - `collapsedas` node.""" + `collapsedas` node. + + If `keepf` is not True, the rebase has --keep set and no nodes should be + removed (but bookmarks still need to be moved). + """ tonode = repo.changelog.node - # Move bookmark of skipped nodes to destination. This cannot be handled - # by scmutil.cleanupnodes since it will treat rev as removed (no successor) - # and move bookmark backwards. - bmchanges = [(name, tonode(max(adjustdest(repo, rev, dest, state)))) - for rev in skipped - for name in repo.nodebookmarks(tonode(rev))] - if bmchanges: - with repo.transaction('rebase') as tr: - repo._bookmarks.applychanges(repo, tr, bmchanges) - mapping = {} + replacements = {} + moves = {} for rev, newrev in sorted(state.items()): if newrev >= 0 and newrev != rev: - if rev in skipped: - succs = () - elif collapsedas is not None: - succs = (collapsedas,) - else: - succs = (tonode(newrev),) - mapping[tonode(rev)] = succs - scmutil.cleanupnodes(repo, mapping, 'rebase') + oldnode = tonode(rev) + newnode = collapsedas or tonode(newrev) + moves[oldnode] = newnode + if not keepf: + if rev in skipped: + succs = () + else: + succs = (newnode,) + replacements[oldnode] = succs + scmutil.cleanupnodes(repo, replacements, 'rebase', moves) def pullrebase(orig, ui, repo, *args, **opts): 'Call rebase after pull if the latter has been invoked with --rebase' diff -Nru mercurial-4.3.2~trusty1/.hgsigs mercurial-4.3.3~trusty1/.hgsigs --- mercurial-4.3.2~trusty1/.hgsigs 2017-09-18 15:51:41.000000000 +0000 +++ mercurial-4.3.3~trusty1/.hgsigs 2017-09-18 17:54:00.000000000 +0000 @@ -150,3 +150,4 @@ 5544af8622863796a0027566f6b646e10d522c4c 0 iQIcBAABCAAGBQJZjJflAAoJELnJ3IJKpb3V19kQALCvTdPrpce5+rBNbFtLGNFxTMDol1dUy87EUAWiArnfOzW3rKBdYxvxDL23BpgUfjRm1fAXdayVvlj6VC6Dyb195OLmc/I9z7SjFxsfmxWilF6U0GIa3W0x37i05EjfcccrBIuSLrvR6AWyJhjLOBCcyAqD/HcEom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okcK6MFnieAFouROoGNlQXQtzj6cMqK+LGCP/NeJEG323gAxpxMzc32g7TqbVEhKNqNK8HvQSt04aCVZXtBmP0cPzc348UPP1X1iPTkyZxaJ0kHulaHVptwGbFZZyhwGefauU4eMafJsYqwgiGmvDpjUFu6P8YJXliYeTo1HX2lNChS1xmvJbop1YHfBYACsi8Eron0vMuhaQ+TKYq8Zd762u2roRYnaQ23ubEaVsjGDUYxXXVmit2gdaEKk+6Rq2I+EgcI5XvFzK8gvoP7siz6FL1jVf715k9/UYoWj9KDNUm8cweiyiUpjHQt0S+Ro9ryKvQy6tQVunRZqBN/kZWVth/FlMbUENbxVyXZcXv+m7OLvk+vyK7UZ7yT+OBzgRr0PyUuafzSVW3e+RZJtGxYGM5ew2bWQ8L6wuBucRYZOSnXXtCw7cKEMlK3BTjfAfpHUdIZIG492R9d6aOECUK/MpNvCiXXaZoh5Kj4a0dARiuWFCZxWwt3bmOg13oQ841zLdzOi/YZe15vCm8OB4Ffg6CkmPKhZhnMwVbFmlaBcoaeMzzpMuog91J1M2zgEUBTYwe/HKiNr/0iilJMPFRpZ+zEb2GvVoc8FMttXi8aomlXf/6LHCC9ndexGC29jIzl41+ diff -Nru mercurial-4.3.2~trusty1/.hgtags mercurial-4.3.3~trusty1/.hgtags --- mercurial-4.3.2~trusty1/.hgtags 2017-09-18 15:51:41.000000000 +0000 +++ mercurial-4.3.3~trusty1/.hgtags 2017-09-18 17:54:00.000000000 +0000 @@ -163,3 +163,4 @@ 5544af8622863796a0027566f6b646e10d522c4c 4.3 943c91326b23954e6e1c6960d0239511f9530258 4.2.3 3fee7f7d2da04226914c2258cc2884dc27384fd7 4.3.1 +920977f72c7b70acfdaf56ab35360584d7845827 4.3.2 diff -Nru mercurial-4.3.2~trusty1/mercurial/scmutil.py mercurial-4.3.3~trusty1/mercurial/scmutil.py --- mercurial-4.3.2~trusty1/mercurial/scmutil.py 2017-09-18 15:51:41.000000000 +0000 +++ mercurial-4.3.3~trusty1/mercurial/scmutil.py 2017-09-18 17:54:00.000000000 +0000 @@ -576,41 +576,59 @@ def __contains__(self, node): return self._revcontains(self._torev(node)) -def cleanupnodes(repo, mapping, operation): +def cleanupnodes(repo, replacements, operation, moves=None): """do common cleanups when old nodes are replaced by new nodes That includes writing obsmarkers or stripping nodes, and moving bookmarks. (we might also want to move working directory parent in the future) - mapping is {oldnode: [newnode]} or a iterable of nodes if they do not have - replacements. operation is a string, like "rebase". + By default, bookmark moves are calculated automatically from 'replacements', + but 'moves' can be used to override that. Also, 'moves' may include + additional bookmark moves that should not have associated obsmarkers. + + replacements is {oldnode: [newnode]} or a iterable of nodes if they do not + have replacements. operation is a string, like "rebase". """ - if not util.safehasattr(mapping, 'items'): - mapping = {n: () for n in mapping} + if not replacements and not moves: + return + + # translate mapping's other forms + if not util.safehasattr(replacements, 'items'): + replacements = {n: () for n in replacements} + + # Calculate bookmark movements + if moves is None: + moves = {} + # Unfiltered repo is needed since nodes in replacements might be hidden. + unfi = repo.unfiltered() + for oldnode, newnodes in replacements.items(): + if oldnode in moves: + continue + if len(newnodes) > 1: + # usually a split, take the one with biggest rev number + newnode = next(unfi.set('max(%ln)', newnodes)).node() + elif len(newnodes) == 0: + # move bookmark backwards + roots = list(unfi.set('max((::%n) - %ln)', oldnode, + list(replacements))) + if roots: + newnode = roots[0].node() + else: + newnode = nullid + else: + newnode = newnodes[0] + moves[oldnode] = newnode with repo.transaction('cleanup') as tr: # Move bookmarks bmarks = repo._bookmarks bmarkchanges = [] - allnewnodes = [n for ns in mapping.values() for n in ns] - for oldnode, newnodes in mapping.items(): + allnewnodes = [n for ns in replacements.values() for n in ns] + for oldnode, newnode in moves.items(): oldbmarks = repo.nodebookmarks(oldnode) if not oldbmarks: continue from . import bookmarks # avoid import cycle - if len(newnodes) > 1: - # usually a split, take the one with biggest rev number - newnode = next(repo.set('max(%ln)', newnodes)).node() - elif len(newnodes) == 0: - # move bookmark backwards - roots = list(repo.set('max((::%n) - %ln)', oldnode, - list(mapping))) - if roots: - newnode = roots[0].node() - else: - newnode = nullid - else: - newnode = newnodes[0] repo.ui.debug('moving bookmarks %r from %s to %s\n' % (oldbmarks, hex(oldnode), hex(newnode))) # Delete divergent bookmarks being parents of related newnodes @@ -633,18 +651,19 @@ # Also sort the node in topology order, that might be useful for # some obsstore logic. # NOTE: the filtering and sorting might belong to createmarkers. - # Unfiltered repo is needed since nodes in mapping might be hidden. - unfi = repo.unfiltered() isobs = unfi.obsstore.successors.__contains__ torev = unfi.changelog.rev sortfunc = lambda ns: torev(ns[0]) rels = [(unfi[n], tuple(unfi[m] for m in s)) - for n, s in sorted(mapping.items(), key=sortfunc) + for n, s in sorted(replacements.items(), key=sortfunc) if s or not isobs(n)] - obsolete.createmarkers(repo, rels, operation=operation) + if rels: + obsolete.createmarkers(repo, rels, operation=operation) else: from . import repair # avoid import cycle - repair.delayedstrip(repo.ui, repo, list(mapping), operation) + tostrip = list(replacements) + if tostrip: + repair.delayedstrip(repo.ui, repo, tostrip, operation) def addremove(repo, matcher, prefix, opts=None, dry_run=None, similarity=None): if opts is None: diff -Nru mercurial-4.3.2~trusty1/mercurial/ui.py mercurial-4.3.3~trusty1/mercurial/ui.py --- mercurial-4.3.2~trusty1/mercurial/ui.py 2017-09-18 15:51:41.000000000 +0000 +++ mercurial-4.3.3~trusty1/mercurial/ui.py 2017-09-18 17:54:00.000000000 +0000 @@ -1481,7 +1481,7 @@ def _progclear(self): """clear progress bar output if any. use it before any output""" - if '_progbar' not in vars(self): # nothing loaded yet + if not haveprogbar(): # nothing loaded yet return if self._progbar is not None and self._progbar.printed: self._progbar.clear() @@ -1785,3 +1785,6 @@ # this is how the extension used to work but feel free to rework it. _progresssingleton = progress.progbar(ui) return _progresssingleton + +def haveprogbar(): + return _progresssingleton is not None diff -Nru mercurial-4.3.2~trusty1/tests/test-rebase-bookmarks.t mercurial-4.3.3~trusty1/tests/test-rebase-bookmarks.t --- mercurial-4.3.2~trusty1/tests/test-rebase-bookmarks.t 2017-09-18 15:51:41.000000000 +0000 +++ mercurial-4.3.3~trusty1/tests/test-rebase-bookmarks.t 2017-09-18 17:54:00.000000000 +0000 @@ -1,6 +1,7 @@ $ cat >> $HGRCPATH < [extensions] > rebase= + > drawdag=$TESTDIR/drawdag.py > > [phases] > publish=False @@ -210,3 +211,35 @@ rebasing 6:f677a2907404 "bisect2" rebasing 7:325c16001345 "bisect3" (tip bisect) saved backup bundle to $TESTTMP/a3/.hg/strip-backup/345c90f326a4-b4840586-rebase.hg (glob) + +Bookmark and working parent get moved even if --keep is set (issue5682) + + $ hg init $TESTTMP/book-keep + $ cd $TESTTMP/book-keep + $ hg debugdrawdag <<'EOS' + > B C + > |/ + > A + > EOS + $ eval `hg tags -T 'hg bookmark -ir {node} {tag};\n' | grep -v tip` + $ rm .hg/localtags + $ hg up -q B + $ hg tglog + o 2: 'C' bookmarks: C + | + | @ 1: 'B' bookmarks: B + |/ + o 0: 'A' bookmarks: A + + $ hg rebase -r B -d C --keep + rebasing 1:112478962961 "B" (B) + $ hg tglog + @ 3: 'B' bookmarks: B + | + o 2: 'C' bookmarks: C + | + | o 1: 'B' bookmarks: + |/ + o 0: 'A' bookmarks: A + + diff -Nru mercurial-4.3.2~trusty1/tests/test-rebase-emptycommit.t mercurial-4.3.3~trusty1/tests/test-rebase-emptycommit.t --- mercurial-4.3.2~trusty1/tests/test-rebase-emptycommit.t 2017-09-18 15:51:41.000000000 +0000 +++ mercurial-4.3.3~trusty1/tests/test-rebase-emptycommit.t 2017-09-18 17:54:00.000000000 +0000 @@ -47,7 +47,7 @@ |/ o 0 A -With --keep, bookmark should not move +With --keep, bookmark should move $ hg rebase -r 3+4 -d E --keep rebasing 3:e7b3f00ed42e "D" (BOOK-D) @@ -55,15 +55,15 @@ rebasing 4:69a34c08022a "E" (BOOK-E) note: rebase of 4:69a34c08022a created no changes to commit $ hg log -G -T '{rev} {desc} {bookmarks}' - o 7 E + o 7 E BOOK-D BOOK-E | o 6 D | | o 5 F BOOK-F | | - | o 4 E BOOK-E + | o 4 E | | - | o 3 D BOOK-D + | o 3 D | | | o 2 C BOOK-C | | @@ -71,6 +71,11 @@ |/ o 0 A +Move D and E back for the next test + + $ hg bookmark BOOK-D -fqir 3 + $ hg bookmark BOOK-E -fqir 4 + Bookmark is usually an indication of a head. For changes that are introduced by an ancestor of bookmark B, after moving B to B-NEW, the changes are ideally still introduced by an ancestor of changeset on B-NEW. In the below case, diff -Nru mercurial-4.3.2~trusty1/tests/test-subrepo-deep-nested-change.t mercurial-4.3.3~trusty1/tests/test-subrepo-deep-nested-change.t --- mercurial-4.3.2~trusty1/tests/test-subrepo-deep-nested-change.t 2017-09-18 15:51:41.000000000 +0000 +++ mercurial-4.3.3~trusty1/tests/test-subrepo-deep-nested-change.t 2017-09-18 17:54:00.000000000 +0000 @@ -63,6 +63,14 @@ \r (no-eol) (esc) \r (no-eol) (esc) updating [===========================================>] 3/3\r (no-eol) (esc) + \r (no-eol) (esc) + \r (no-eol) (esc) + linking [ <=> ] 1\r (no-eol) (esc) + linking [ <=> ] 2\r (no-eol) (esc) + linking [ <=> ] 3\r (no-eol) (esc) + linking [ <=> ] 4\r (no-eol) (esc) + linking [ <=> ] 5\r (no-eol) (esc) + linking [ <=> ] 6\r (no-eol) (esc) updating [===========================================>] 1/1\r (no-eol) (esc) \r (no-eol) (esc) updating to branch default @@ -154,7 +162,25 @@ \r (no-eol) (esc) \r (no-eol) (esc) updating [===========================================>] 3/3\r (no-eol) (esc) + \r (no-eol) (esc) + \r (no-eol) (esc) + linking [ <=> ] 1\r (no-eol) (esc) + linking [ <=> ] 2\r (no-eol) (esc) + linking [ <=> ] 3\r (no-eol) (esc) + linking [ <=> ] 4\r (no-eol) (esc) + linking [ <=> ] 5\r (no-eol) (esc) + linking [ <=> ] 6\r (no-eol) (esc) + linking [ <=> ] 7\r (no-eol) (esc) + linking [ <=> ] 8\r (no-eol) (esc) updating [===========================================>] 3/3\r (no-eol) (esc) + \r (no-eol) (esc) + \r (no-eol) (esc) + linking [ <=> ] 1\r (no-eol) (esc) + linking [ <=> ] 2\r (no-eol) (esc) + linking [ <=> ] 3\r (no-eol) (esc) + linking [ <=> ] 4\r (no-eol) (esc) + linking [ <=> ] 5\r (no-eol) (esc) + linking [ <=> ] 6\r (no-eol) (esc) updating [===========================================>] 1/1\r (no-eol) (esc) \r (no-eol) (esc) updating to branch default