]> thyrsus.com Git - src.git/commitdiff
Minor refactoring step. Regression test passes.
authorEric S. Raymond <esr@thyrsus.com>
Tue, 11 Nov 2014 06:59:58 +0000 (01:59 -0500)
committerEric S. Raymond <esr@thyrsus.com>
Tue, 11 Nov 2014 06:59:58 +0000 (01:59 -0500)
src

diff --git a/src b/src
index 1ed54ec64294794e7709b7b38b82cab1cf95ac6f..a2175d22c0339ddbc9cf393fe3053b978217a7f5 100755 (executable)
--- a/src
+++ b/src
@@ -455,8 +455,6 @@ class CommentContext:
                 croak("malformed comment")
         if not self.comment.endswith("\n"):
             self.comment += "\n"
-        # Because it's going to be handed back as a shell argument
-        self.comment = "'" + self.comment.replace("'", r"'\''") + "'"
     def content(self):
         "Reurn the edited comment."
         return self.comment
@@ -945,13 +943,14 @@ class RCS:
         do_or_die("rcs -q -U -kb -i {0} </dev/null && mv {0},v {1}".format(arg, repodir))
     def checkin(self, arg, comment):
         "Check in a commit, with comment."
-        # Relies on caller to escape comment string.  By unlocking the
-        # file before checkin we invoke the following property
-        # described on the rcs(1) manual page: "If rev is omitted and
-        # the caller has no lock, but owns the file and locking is not
-        # set to strict, then the revision is appended to the default
-        # branch (normally the trunk; see the -b option of rcs(1))."
-        # This is the behavior we want and why locking is set to non-strict.
+        comment = "'" + comment.replace("'", r"'\''") + "'"
+        # By unlocking the file before checkin we invoke the following
+        # property described on the rcs(1) manual page: "If rev is
+        # omitted and the caller has no lock, but owns the file and
+        # locking is not set to strict, then the revision is appended
+        # to the default branch (normally the trunk; see the -b option
+        # of rcs(1))."  This is the behavior we want and why locking
+        # is set to non-strict.
         do_or_die("rcs -q -U -u {0},v && ci -l -m{1} {0}".format(arg, comment))
     def checkout(self, arg, revision):
         "Check out a revision. Leaves it writeable."
@@ -959,6 +958,7 @@ class RCS:
     def amend(self, arg, rev, comment):
         "Amend a commit comment."
         # Relies on caller to escape comment string
+        comment = "'" + comment.replace("'", r"'\''") + "'"
         do_or_die("rcs -m{0}:{1} {2}".format(rev, comment, arg))
     def cat(self, arg, revision, fn=""):
         "Ship the contents of a revision to stdout or a named file."