Mercurial > public > mercurial-scm > evolve
diff hgext3rd/topic/__init__.py @ 2648:d8b47d961c77
topic-change: update the working copy along when changing topic of '.'
This avoids leaving the working copy behind, removing another large parts of
issue5441.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Wed, 21 Jun 2017 13:18:47 +0200 |
parents | b9cfb8bd0965 |
children | cf930521f14d |
line wrap: on
line diff
--- a/hgext3rd/topic/__init__.py Wed Jun 21 13:21:08 2017 +0200 +++ b/hgext3rd/topic/__init__.py Wed Jun 21 13:18:47 2017 +0200 @@ -62,6 +62,7 @@ context, error, extensions, + hg, localrepo, lock, merge, @@ -306,8 +307,9 @@ def _changetopics(ui, repo, revset, newtopic): rewrote = 0 needevolve = False - l = txn = None + wl = l = txn = None try: + wl = repo.wlock() l = repo.lock() txn = repo.transaction('rewrite-topics') p1 = None @@ -358,9 +360,19 @@ needevolve = needevolve or (len(c.children()) > 0) obsolete.createmarkers(repo, [(c, (repo[newnode],))]) rewrote += 1 + # move the working copy too + wctx = repo[None] + # in-progress merge is a bit too complexe for now. + if len(wctx.parents()) == 1: + newid = successors.get(wctx.p1().node()) + if newid is not None: + # this provide some useless output we shoudl eventually suppress + # + # 0 files updated, 0 files merged, 0 files removed, 0 files unresolved + hg.update(repo, newid) txn.close() finally: - lock.release(txn, l) + lock.release(txn, l, wl) repo.invalidate() ui.status('changed topic on %d changes\n' % rewrote) if needevolve: