]> thyrsus.com Git - src.git/commitdiff
amend - a work in progress, not yet wired in.
authorEric S. Raymond <esr@thyrsus.com>
Mon, 10 Nov 2014 04:10:34 +0000 (23:10 -0500)
committerEric S. Raymond <esr@thyrsus.com>
Mon, 10 Nov 2014 04:10:34 +0000 (23:10 -0500)
src

diff --git a/src b/src
index 948763b292eb08b711b1016c6c68d8d2fda00a66..b0394f83393b656390df1ac7752679ec2f641949 100755 (executable)
--- a/src
+++ b/src
@@ -503,6 +503,33 @@ def commit_method(*args):
            if not quiet and len(args) > 1:
                announce("%s -> %d" % (arg, len(metadata))) 
 
+def amend_method(*args):
+    "Amend coments in stored revisions."
+    if not os.path.exists(repodir):
+        croak("repository subdirectory %s does not exist" % repodir)
+    args = list(args)
+    comment = get_comment("amend", args)
+    (revspec, args) = preamble("amend", args)
+    for arg in args:
+       if not os.path.exists(arg):
+           croak("I see no '%s' here." % arg)
+       elif not os.path.exists(backend.master(arg)):
+           croak("%s is not registered." % arg)
+       else:
+           metadata = History(arg)
+           revspec = metadata.resolve(revspec)
+           if revspec is None:
+               revspec = metadata.tip().revno
+           elif (revspec[0] != revspec[1]):
+               croak("amend cannot tage a range")
+           if not comment:
+               comment = edit_comment()
+           comment = prepare_comment(comment, metadata)
+           with backend.lifter(arg):
+               backend.amend(arg, revspec, comment)
+           if not quiet and len(args) > 1:
+               announce("%s : %d" % (arg, len(metadata))) 
+
 def list_method(*args):
     "Generate a summary listing of commits, one line per commit."
     (revspec, args) = preamble("list", args)