From dda7bd100860911a63107f630d63e3156395d4d4 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Thu, 13 Nov 2014 07:06:48 -0500 Subject: [PATCH] Ugh. Restore ability to commit new files. This bug should never have been in shipped code, but there was a flaw in my test setup. Regression test passes. --- src | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src b/src index be47fe1..1328dd8 100755 --- 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." -- 2.43.0