comparison hgext/evolution.py @ 130:b70fadbccc2a

evolution: add a --new argument for kill
author Pierre-Yves David <pierre-yves.david@logilab.fr>
date Wed, 11 Jan 2012 17:01:06 +0100
parents 7e113963f2c8
children 3124889cad55
comparison
equal deleted inserted replaced
129:3ad25876ee68 130:b70fadbccc2a
220 ui.warn(_('Multiple non-obsolete children, explicitly update to one\n')) 220 ui.warn(_('Multiple non-obsolete children, explicitly update to one\n'))
221 return 1 221 return 1
222 222
223 223
224 @command('^kill', 224 @command('^kill',
225 [], 225 [
226 ('n', 'new', [], _("New changeset that justify this one to be killed"))
227 ],
226 '<revs>') 228 '<revs>')
227 def kill(ui, repo, *revs): 229 def kill(ui, repo, *revs, **opts):
228 """mark a changeset as obsolete 230 """mark a changeset as obsolete
229 231
230 This update the parent directory to a not-killed parent if the current 232 This update the parent directory to a not-killed parent if the current
231 working directory parent are killed. 233 working directory parent are killed.
232 234
234 XXX handle merge 236 XXX handle merge
235 XXX check immutable first 237 XXX check immutable first
236 """ 238 """
237 wlock = repo.wlock() 239 wlock = repo.wlock()
238 try: 240 try:
241 new = opts['new']
239 targetnodes = set(noderange(repo, revs)) 242 targetnodes = set(noderange(repo, revs))
243 if not new:
244 new = [node.nullid]
240 for n in targetnodes: 245 for n in targetnodes:
241 repo.addobsolete(node.nullid, n) 246 if not repo[n].mutable():
247 ui.warn(_("Can't kill immutable changeset %s") % repo[n])
248 else:
249 for ne in new:
250 repo.addobsolete(ne, n)
242 # update to an unkilled parent 251 # update to an unkilled parent
243 wdp = repo['.'] 252 wdp = repo['.']
244 newnode = wdp 253 newnode = wdp
245 while newnode.obsolete(): 254 while newnode.obsolete():
246 newnode = newnode.parents()[0] 255 newnode = newnode.parents()[0]