]> thyrsus.com Git - src.git/commitdiff
Ugh. Restore ability to commit new files.
authorEric S. Raymond <esr@thyrsus.com>
Thu, 13 Nov 2014 12:06:48 +0000 (07:06 -0500)
committerEric S. Raymond <esr@thyrsus.com>
Thu, 13 Nov 2014 12:06:48 +0000 (07:06 -0500)
This bug should never have been in shipped code, but there was a
flaw in my test setup.

Regression test passes.

src

diff --git a/src b/src
index be47fe1d4bc18b4b6cca91948129cba65e245994..1328dd82352d01fd9fa1b415ff65d13703ca1d26 100755 (executable)
--- a/src
+++ b/src
@@ -570,11 +570,16 @@ def commit_method(*args):
     for arg in ctx.args:
         if not os.path.exists(arg):
             croak("I see no '%s' here." % arg)
-        metadata = History(arg)
-        ctx.resolve(metadata)
-        if ctx.is_empty():
-            ctx.select_tip(metadata)
-        trailer ="Committing {0} revision {1}.\n".format(arg, ctx.start)
+        if os.path.exists(backend.master(arg)):
+            metadata = History(arg)
+            ctx.resolve(metadata)
+            if ctx.is_empty():
+                ctx.select_tip(metadata)
+            trailer = "Committing {0} revision {1}.\n".format(arg, ctx.start)
+            revcount = len(metadata)
+        else:
+            trailer = "Committing initial revision of {0}".format(arg)
+            revcount = 0
         if not comment.edit(content="", trailer=trailer):
             announce("in %s, commit cancelled" % arg)
         else:
@@ -583,7 +588,7 @@ def commit_method(*args):
             with backend.lifter(arg):
                 backend.checkin(arg, comment.content())
             if not quiet and len(args) > 1:
-                announce("%s -> %d" % (arg, len(metadata)))
+                announce("%s -> %d" % (arg, revcount))
 
 def amend_method(*args):
     "Amend comments in stored revisions."