diff -r ea4675c7a028 -r a840c5b5bbaf hgext3rd/topic/__init__.py --- a/hgext3rd/topic/__init__.py Sat Mar 19 14:15:45 2016 -0700 +++ b/hgext3rd/topic/__init__.py Sat Mar 19 14:15:57 2016 -0700 @@ -214,43 +214,43 @@ l = repo.lock() txn = repo.transaction('rewrite-topics') try: - for c in repo.set('%r', change): - def filectxfn(repo, ctx, path): - try: - return c[path] - except error.ManifestLookupError: - return None - fixedextra = dict(c.extra()) - ui.debug('old node id is %s\n' % node.hex(c.node())) - ui.debug('origextra: %r\n' % fixedextra) - newtopic = None if clear else topic - oldtopic = fixedextra.get(constants.extrakey, None) - if oldtopic == newtopic: - continue - if clear: - del fixedextra[constants.extrakey] - else: - fixedextra[constants.extrakey] = topic - if 'amend_source' in fixedextra: - # TODO: right now the commitctx wrapper in - # topicrepo overwrites the topic in extra if - # amend_source is set to support 'hg commit - # --amend'. Support for amend should be adjusted - # to not be so invasive. - del fixedextra['amend_source'] - ui.debug('changing topic of %s from %s to %s\n' % ( - c, oldtopic, newtopic)) - ui.debug('fixedextra: %r\n' % fixedextra) - mc = context.memctx( - repo, (c.p1().node(), c.p2().node()), c.description(), - c.files(), filectxfn, - user=c.user(), date=c.date(), extra=fixedextra) - newnode = repo.commitctx(mc) - ui.debug('new node id is %s\n' % node.hex(newnode)) - needevolve = needevolve or (len(c.children()) > 0) - obsolete.createmarkers(repo, [(c, (repo[newnode],))]) - rewrote += 1 - txn.close() + for c in repo.set('%r', change): + def filectxfn(repo, ctx, path): + try: + return c[path] + except error.ManifestLookupError: + return None + fixedextra = dict(c.extra()) + ui.debug('old node id is %s\n' % node.hex(c.node())) + ui.debug('origextra: %r\n' % fixedextra) + newtopic = None if clear else topic + oldtopic = fixedextra.get(constants.extrakey, None) + if oldtopic == newtopic: + continue + if clear: + del fixedextra[constants.extrakey] + else: + fixedextra[constants.extrakey] = topic + if 'amend_source' in fixedextra: + # TODO: right now the commitctx wrapper in + # topicrepo overwrites the topic in extra if + # amend_source is set to support 'hg commit + # --amend'. Support for amend should be adjusted + # to not be so invasive. + del fixedextra['amend_source'] + ui.debug('changing topic of %s from %s to %s\n' % ( + c, oldtopic, newtopic)) + ui.debug('fixedextra: %r\n' % fixedextra) + mc = context.memctx( + repo, (c.p1().node(), c.p2().node()), c.description(), + c.files(), filectxfn, + user=c.user(), date=c.date(), extra=fixedextra) + newnode = repo.commitctx(mc) + ui.debug('new node id is %s\n' % node.hex(newnode)) + needevolve = needevolve or (len(c.children()) > 0) + obsolete.createmarkers(repo, [(c, (repo[newnode],))]) + rewrote += 1 + txn.close() except: try: txn.abort()