Mercurial > evolve
comparison 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 |
comparison
equal
deleted
inserted
replaced
2647:b9cfb8bd0965 | 2648:d8b47d961c77 |
---|---|
60 cmdutil, | 60 cmdutil, |
61 commands, | 61 commands, |
62 context, | 62 context, |
63 error, | 63 error, |
64 extensions, | 64 extensions, |
65 hg, | |
65 localrepo, | 66 localrepo, |
66 lock, | 67 lock, |
67 merge, | 68 merge, |
68 namespaces, | 69 namespaces, |
69 node, | 70 node, |
304 return stack.showstack(ui, repo, topic, opts) | 305 return stack.showstack(ui, repo, topic, opts) |
305 | 306 |
306 def _changetopics(ui, repo, revset, newtopic): | 307 def _changetopics(ui, repo, revset, newtopic): |
307 rewrote = 0 | 308 rewrote = 0 |
308 needevolve = False | 309 needevolve = False |
309 l = txn = None | 310 wl = l = txn = None |
310 try: | 311 try: |
312 wl = repo.wlock() | |
311 l = repo.lock() | 313 l = repo.lock() |
312 txn = repo.transaction('rewrite-topics') | 314 txn = repo.transaction('rewrite-topics') |
313 p1 = None | 315 p1 = None |
314 p2 = None | 316 p2 = None |
315 successors = {} | 317 successors = {} |
356 successors[c.node()] = newnode | 358 successors[c.node()] = newnode |
357 ui.debug('new node id is %s\n' % node.hex(newnode)) | 359 ui.debug('new node id is %s\n' % node.hex(newnode)) |
358 needevolve = needevolve or (len(c.children()) > 0) | 360 needevolve = needevolve or (len(c.children()) > 0) |
359 obsolete.createmarkers(repo, [(c, (repo[newnode],))]) | 361 obsolete.createmarkers(repo, [(c, (repo[newnode],))]) |
360 rewrote += 1 | 362 rewrote += 1 |
363 # move the working copy too | |
364 wctx = repo[None] | |
365 # in-progress merge is a bit too complexe for now. | |
366 if len(wctx.parents()) == 1: | |
367 newid = successors.get(wctx.p1().node()) | |
368 if newid is not None: | |
369 # this provide some useless output we shoudl eventually suppress | |
370 # | |
371 # 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
372 hg.update(repo, newid) | |
361 txn.close() | 373 txn.close() |
362 finally: | 374 finally: |
363 lock.release(txn, l) | 375 lock.release(txn, l, wl) |
364 repo.invalidate() | 376 repo.invalidate() |
365 ui.status('changed topic on %d changes\n' % rewrote) | 377 ui.status('changed topic on %d changes\n' % rewrote) |
366 if needevolve: | 378 if needevolve: |
367 evolvetarget = 'topic(%s)' % newtopic if newtopic else 'not topic()' | 379 evolvetarget = 'topic(%s)' % newtopic if newtopic else 'not topic()' |
368 ui.status('please run hg evolve --rev "%s" now\n' % evolvetarget) | 380 ui.status('please run hg evolve --rev "%s" now\n' % evolvetarget) |