hgext3rd/topic/__init__.py
changeset 2691 9b68a2083dac
parent 2679 5156a67f66a6
child 2705 a7b7471b4bed
equal deleted inserted replaced
2690:5d839e1f0ce9 2691:9b68a2083dac
   338         if repo.vfs.exists('topic'):
   338         if repo.vfs.exists('topic'):
   339             repo.vfs.unlink('topic')
   339             repo.vfs.unlink('topic')
   340 
   340 
   341 def _changetopics(ui, repo, revset, newtopic):
   341 def _changetopics(ui, repo, revset, newtopic):
   342     rewrote = 0
   342     rewrote = 0
   343     needevolve = False
       
   344     wl = l = txn = None
   343     wl = l = txn = None
   345     try:
   344     try:
   346         wl = repo.wlock()
   345         wl = repo.wlock()
   347         l = repo.lock()
   346         l = repo.lock()
   348         txn = repo.transaction('rewrite-topics')
   347         txn = repo.transaction('rewrite-topics')
   390                 c.files(), filectxfn,
   389                 c.files(), filectxfn,
   391                 user=c.user(), date=c.date(), extra=fixedextra)
   390                 user=c.user(), date=c.date(), extra=fixedextra)
   392             newnode = repo.commitctx(mc)
   391             newnode = repo.commitctx(mc)
   393             successors[c.node()] = newnode
   392             successors[c.node()] = newnode
   394             ui.debug('new node id is %s\n' % node.hex(newnode))
   393             ui.debug('new node id is %s\n' % node.hex(newnode))
   395             needevolve = needevolve or (len(c.children()) > 0)
       
   396             obsolete.createmarkers(repo, [(c, (repo[newnode],))])
   394             obsolete.createmarkers(repo, [(c, (repo[newnode],))])
   397             rewrote += 1
   395             rewrote += 1
   398         # move the working copy too
   396         # move the working copy too
   399         wctx = repo[None]
   397         wctx = repo[None]
   400         # in-progress merge is a bit too complex for now.
   398         # in-progress merge is a bit too complex for now.
   405         txn.close()
   403         txn.close()
   406     finally:
   404     finally:
   407         lock.release(txn, l, wl)
   405         lock.release(txn, l, wl)
   408         repo.invalidate()
   406         repo.invalidate()
   409     ui.status('changed topic on %d changes\n' % rewrote)
   407     ui.status('changed topic on %d changes\n' % rewrote)
   410     if needevolve:
       
   411         evolvetarget = 'topic(%s)' % newtopic if newtopic else 'not topic()'
       
   412         ui.status('please run hg evolve --rev "%s" now\n' % evolvetarget)
       
   413 
   408 
   414 def _listtopics(ui, repo, opts):
   409 def _listtopics(ui, repo, opts):
   415     fm = ui.formatter('topics', opts)
   410     fm = ui.formatter('topics', opts)
   416     activetopic = repo.currenttopic
   411     activetopic = repo.currenttopic
   417     namemask = '%s'
   412     namemask = '%s'