debugbuilddag: read DAG from stdin if not given on cmdline
authorMartin Geisler <mg@aragost.com>
Mon, 09 May 2011 18:11:08 +0200
changeset 14283 035489c9ea53
parent 14282 10286a04fbd9
child 14284 1f9e11f65cd7
debugbuilddag: read DAG from stdin if not given on cmdline
mercurial/commands.py
--- a/mercurial/commands.py	Mon May 09 17:20:15 2011 +0200
+++ b/mercurial/commands.py	Mon May 09 18:11:08 2011 +0200
@@ -968,11 +968,14 @@
     a = r.ancestor(lookup(rev1), lookup(rev2))
     ui.write("%d:%s\n" % (r.rev(a), hex(a)))
 
-def debugbuilddag(ui, repo, text,
+def debugbuilddag(ui, repo, text=None,
                   mergeable_file=False,
                   overwritten_file=False,
                   new_file=False):
-    """builds a repo with a given dag from scratch in the current empty repo
+    """builds a repo with a given DAG from scratch in the current empty repo
+
+    The description of the DAG is read from stdin if not given on the
+    command line.
 
     Elements:
 
@@ -1001,6 +1004,10 @@
     be enclosed in double quotes ("..."), with "\\" as escape character.
     """
 
+    if text is None:
+        ui.status(_("reading DAG from stdin\n"))
+        text = sys.stdin.read()
+
     cl = repo.changelog
     if len(cl) > 0:
         raise util.Abort(_('repository is not empty'))
@@ -4566,7 +4573,7 @@
           ('o', 'overwritten-file', None, _('add single file all revs overwrite')),
           ('n', 'new-file', None, _('add new file at each rev')),
          ],
-         _('[OPTION]... TEXT')),
+         _('[OPTION]... [TEXT]')),
     "debugbundle":
         (debugbundle,
          [('a', 'all', None, _('show all details')),