Commits

Pierre-Yves David committed 9ffe946

Autogenerate command table.

Comments (0)

Files changed (1)

 # 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>')