Mercurial > evolve
changeset 18:9ffe946febc0
Autogenerate command table.
author | Pierre-Yves David <pierre-yves.david@ens-lyon.org> |
---|---|
date | Wed, 25 May 2011 02:27:40 +0200 |
parents | 6aa349f47e7c |
children | 8784a989a572 |
files | states.py |
diffstat | 1 files changed, 11 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/states.py Wed May 25 02:27:09 2011 +0200 +++ b/states.py Wed May 25 02:27:40 2011 +0200 @@ -107,21 +107,18 @@ # New commands ############################# -def cmdpublished(ui, repo, *changesets): - revs = scmutil.revrange(repo, changesets) - repo.setstate(ST0, [repo.changelog.node(rev) for rev in revs]) - return 0 +cmdtable = {} -def cmdready(ui, repo, *changesets): - revs = scmutil.revrange(repo, changesets) - repo.setstate(ST1, [repo.changelog.node(rev) for rev in revs]) - return 0 - -#autogen this -cmdtable = { - 'published': (cmdpublished, [], _('<revset>')), - 'ready': (cmdready, [], _('<revset>')), - } +def makecmd(state): + def cmdmoveheads(ui, repo, *changesets): + revs = scmutil.revrange(repo, changesets) + repo.setstate(state, [repo.changelog.node(rev) for rev in revs]) + return 0 + return cmdmoveheads +for state in STATES: + if state.trackheads: + cmdmoveheads = makecmd(state) + cmdtable[state.name] = (cmdmoveheads, [], '<revset>')