comparison hgext/evolution.py @ 87:246b8fefd0a5

[evolution/obsolete] very experimental and crude evolve support.
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
date Mon, 19 Sep 2011 03:18:08 +0200
parents 8108d566a8b5
children 64fe5a4f877e
comparison
equal deleted inserted replaced
86:7f763bada042 87:246b8fefd0a5
30 ### extension check 30 ### extension check
31 ############################# 31 #############################
32 32
33 def extsetup(ui): 33 def extsetup(ui):
34 try: 34 try:
35 rebase = extensions.find('obsolete') 35 obsolete = extensions.find('obsolete')
36 except KeyError: 36 except KeyError:
37 raise error.Abort(_('evolution extension require obsolete extension.')) 37 raise error.Abort(_('evolution extension require obsolete extension.'))
38 try:
39 rebase = extensions.find('rebase')
40 except KeyError:
41 raise error.Abort(_('evolution extension require rebase extension.'))
38 42
39 ### changeset rewriting logic 43 ### changeset rewriting logic
40 ############################# 44 #############################
41 45
42 def rewrite(repo, old, updates, head, newbases, commitopts): 46 def rewrite(repo, old, updates, head, newbases, commitopts):
107 ### new command 111 ### new command
108 ############################# 112 #############################
109 cmdtable = {} 113 cmdtable = {}
110 command = cmdutil.command(cmdtable) 114 command = cmdutil.command(cmdtable)
111 115
116 @command('^evolve',
117 [],
118 '')
119 def evolve(ui, repo):
120 """suggest the next evolution step"""
121 obsolete = extensions.find('obsolete')
122 next = min(obsolete.unstables(repo))
123 obs = repo[next].parents()[0]
124 if not obs.obsolete():
125 obs = next.parents()[1]
126 assert obs.obsolete()
127 newer = obsolete.newerversion(repo, obs.node())
128 target = newer[-1]
129 repo.ui.status('hg rebase --dest %s --source %s --detach \n' % (repo[target].rev(), next))
130
131
132
112 @command('^kill', 133 @command('^kill',
113 [], 134 [],
114 '<revs>') 135 '<revs>')
115 def kill(ui, repo, *revs): 136 def kill(ui, repo, *revs):
116 """mark a changeset as obsolete 137 """mark a changeset as obsolete