Autogenerate command table.
--- 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>')