Mercurial > evolve
comparison hgext/evolve.py @ 137:bbc653876876
fix evolve test
author | Pierre-Yves David <pierre-yves.david@logilab.fr> |
---|---|
date | Fri, 17 Feb 2012 19:01:25 +0100 |
parents | aa182b912d62 |
children | 9b9500175ae5 |
comparison
equal
deleted
inserted
replaced
136:915728be8afd | 137:bbc653876876 |
---|---|
154 ### new command | 154 ### new command |
155 ############################# | 155 ############################# |
156 cmdtable = {} | 156 cmdtable = {} |
157 command = cmdutil.command(cmdtable) | 157 command = cmdutil.command(cmdtable) |
158 | 158 |
159 @command('^evolve', | 159 @command('^stabilize', |
160 [], | 160 [], |
161 '') | 161 '') |
162 def evolve(ui, repo): | 162 def stabilize(ui, repo): |
163 """suggest the next evolution step""" | 163 """suggest the next evolution step""" |
164 obsolete = extensions.find('obsolete') | 164 obsolete = extensions.find('obsolete') |
165 next = min(obsolete.unstables(repo)) | 165 unstable = repo.revs('unstable()') |
166 if not unstable: | |
167 ui.write_err(_('no unstable changeset\n')) | |
168 return 1 | |
169 next = unstable[0] | |
166 obs = repo[next].parents()[0] | 170 obs = repo[next].parents()[0] |
167 if not obs.obsolete(): | 171 if not obs.obsolete(): |
168 obs = next.parents()[1] | 172 obs = next.parents()[1] |
169 assert obs.obsolete() | 173 assert obs.obsolete() |
170 newer = obsolete.newerversion(repo, obs.node()) | 174 newer = obsolete.newerversion(repo, obs.node()) |
171 target = newer[-1] | 175 if len(newer) > 1: |
172 repo.ui.status('hg relocate --rev %s %s\n' % (repo[next], repo[target])) | 176 ui.write_err(_("conflict rewriting. can't choose destination\n")) |
177 return 2 | |
178 targets = newer[0] | |
179 if not targets: | |
180 ui.write_err(_("does not handle kill parent yet\n")) | |
181 return 2 | |
182 if len(targets) > 1: | |
183 ui.write_err(_("does not handle splitted parent yet\n")) | |
184 return 2 | |
185 target = targets[0] | |
186 repo.ui.status('hg rebase -Dr %s -d %s\n' % (repo[next], repo[target])) | |
173 | 187 |
174 shorttemplate = '[{rev}] {desc|firstline}\n' | 188 shorttemplate = '[{rev}] {desc|firstline}\n' |
175 | 189 |
176 @command('^gdown', | 190 @command('^gdown', |
177 [], | 191 [], |
353 wlock.release() | 367 wlock.release() |
354 finally: | 368 finally: |
355 lock.release() | 369 lock.release() |
356 | 370 |
357 def commitwrapper(orig, ui, repo, *arg, **kwargs): | 371 def commitwrapper(orig, ui, repo, *arg, **kwargs): |
358 obsoleted = kwargs.get('obsolete', []) | 372 lock = repo.lock() |
359 if obsoleted: | 373 try: |
360 obsoleted = repo.set('%lr', obsoleted) | 374 obsoleted = kwargs.get('obsolete', []) |
361 result = orig(ui, repo, *arg, **kwargs) | 375 if obsoleted: |
362 if not result: # commit successed | 376 obsoleted = repo.set('%lr', obsoleted) |
363 new = repo['-1'] | 377 result = orig(ui, repo, *arg, **kwargs) |
364 for old in obsoleted: | 378 if not result: # commit successed |
365 repo.addobsolete(new.node(), old.node()) | 379 new = repo['-1'] |
366 return result | 380 oldbookmarks = [] |
381 for old in obsoleted: | |
382 oldbookmarks.extend(repo.nodebookmarks(old.node())) | |
383 repo.addobsolete(new.node(), old.node()) | |
384 for book in oldbookmarks: | |
385 repo._bookmarks[book] = new.node() | |
386 if oldbookmarks: | |
387 bookmarks.write(repo) | |
388 return result | |
389 finally: | |
390 lock.release() | |
367 | 391 |
368 def graftwrapper(orig, ui, repo, *revs, **kwargs): | 392 def graftwrapper(orig, ui, repo, *revs, **kwargs): |
369 lock = repo.lock() | 393 lock = repo.lock() |
370 try: | 394 try: |
371 if kwargs.get('old_obsolete'): | 395 if kwargs.get('old_obsolete'): |