Next: , Previous: Database, Up: Command Reference



5.9 Automation

This section contains subcommands of the monotone automate command, used for scripting monotone. All give output on stdout; they may also give useful chatter on stderr, including warnings and error messages.

monotone automate interface_version
Arguments:
None.
Added in:
0.0
Purpose:
Prints version of the automation interface. Major number increments whenever a backwards incompatible change is made to the automate command; minor number increments whenever any change is made (but is reset when major number increments).
Sample output:
          
          1.2
     

Output format:
A decimal number, followed by “.” (full stop/period), followed by a decimal number, followed by a newline, followed by end-of-file. The first decimal number is the major version, the second is the minor version.
Error conditions:
None.

monotone automate heads branch
Arguments:
One argument branch, a branch name.
Added in:
0.0
Purpose:
Prints the heads of branch branch.
Sample output:
          
          28ce076c69eadb9b1ca7bdf9d40ce95fe2f29b61
          75156724e0e2e3245838f356ec373c50fa469f1f
     

Output format:
Zero or more lines, each giving the id of one head of the given branch. Each line consists of a revision id, in hexadecimal, followed by a newline. The lines are printed in alphabetically sorted order.
Error conditions:
If the given branch contains no members, then no lines are printed.

monotone automate descendents rev1 [rev2 [...]]
Arguments:
One or more revision ids, rev1, rev2, etc.
Added in:
0.1
Purpose:
Prints the descendents of one or more revisions.
Sample output:
          
          28ce076c69eadb9b1ca7bdf9d40ce95fe2f29b61
          75156724e0e2e3245838f356ec373c50fa469f1f
     

Output format:
Zero or more lines, each giving the id of one descendent of the given revisions. Each line consists of a revision id, in hexadecimal, followed by a newline. The lines are printed in alphabetically sorted order.

The output does not include rev1, rev2, etc., except that if rev2 is itself a descendent of rev1, then rev2 will be included in the output.

Error conditions:
If any of the revisions do not exist, prints nothing to stdout, prints an error message to stderr, and exits with status 1.

monotone automate erase_ancestors [rev1 [rev2 [...]]]
Arguments:
One or more revision ids, rev1, rev2, etc.
Added in:
0.1
Purpose:
Prints all arguments, except those that are an ancestor of some other argument. One way to think about this is that it prints the minimal elements of the given set, under the ordering imposed by the “child of” relation. Another way to think of it is if the arguments formed a branch branch, then we would print the heads of that branch. If there are no arguments, prints nothing.
Sample output:
          
          28ce076c69eadb9b1ca7bdf9d40ce95fe2f29b61
          75156724e0e2e3245838f356ec373c50fa469f1f
     

Output format:
Zero or more lines, each giving the id of one descendent of the given revisions. Each line consists of a revision id, in hexadecimal, followed by a newline. The lines are printed in alphabetically sorted order.
Error conditions:
If any of the revisions do not exist, prints nothing to stdout, prints an error message to stderr, and exits with status 1.

monotone automate toposort [rev1 [rev2 [...]]]
Arguments:
One or more revision ids, rev1, rev2, etc.
Added in:
0.1
Purpose:
Prints all arguments, topologically sorted. I.e., if rev1 is an ancestor of rev2, then rev1 will appear before rev2 in the output; if rev2 is an ancestor of rev1, then rev2 will appear before rev1 in the output; and if neither is an ancestor of the other, then they may appear in either order. If there are no arguments, prints nothing.
Sample output:
          
          28ce076c69eadb9b1ca7bdf9d40ce95fe2f29b61
          75156724e0e2e3245838f356ec373c50fa469f1f
     

Output format:
A list of revision ids, in hexadecimal, each followed by a newline. Revisions are printed in topologically sorted order.
Error conditions:
If any of the revisions do not exist, prints nothing to stdout, prints an error message to stderr, and exits with status 1.

monotone automate ancestry_difference new [old1 [old2 [...]]]
Arguments:
A “new” revision id new, followed by zero or more “old” revision ids old1, old2, etc.
Added in:
0.1
Purpose:
Prints all ancestors of the revision new, that are not also ancestors of one of the old revisions. For purposes of this command, “ancestor” is an inclusive term; for example, if new is an ancestor of old1, it will not be printed; but if new is not an ancestor of any of the “old” revisions, then it will be. Similarly, old1 will never be printed, because it is considered to be an ancestor of itself. The reason for the names is that if new a new revision, and old1, old2, etc. are revisions that you have processed before, then this command tells you which revisions are new since then.
Sample output:
          
          28ce076c69eadb9b1ca7bdf9d40ce95fe2f29b61
          75156724e0e2e3245838f356ec373c50fa469f1f
     

Output format:
A list of revision ids, in hexadecimal, each followed by a newline. Revisions are printed in topologically sorted order.
Error conditions:
If any of the revisions do not exist, prints nothing to stdout, prints an error message to stderr, and exits with status 1.

monotone automate leaves
Arguments:
None.
Added in:
0.1
Purpose:
Prints the leaves of the revision graph, i.e. all revision that have no children. This is similar, but not identical to the functionality of heads, which prints every revision in a branch, that has no descendents in that branch. If every revision in the database was in the same branch, then they would be identical. Generally, every leaf is the head of some branch, but not every branch head is a leaf.
Sample output:
          
          28ce076c69eadb9b1ca7bdf9d40ce95fe2f29b61
          75156724e0e2e3245838f356ec373c50fa469f1f
     

Output format:
Zero or more lines, each a leaf of the revision graph. Each line consists of a revision id, in hexadecimal, followed by a newline. The lines are printed in alphabetically sorted order.
Error conditions:
None.