]> thyrsus.com Git - src.git/commitdiff
src release (documented but untested.
authorEric S. Raymond <esr@thyrsus.com>
Sun, 9 Nov 2014 20:28:53 +0000 (15:28 -0500)
committerEric S. Raymond <esr@thyrsus.com>
Sun, 9 Nov 2014 20:28:53 +0000 (15:28 -0500)
src
src.asc

diff --git a/src b/src
index f5d51c52d3a537997c7f3f53ad09c2ed63a6eaba..ef822c1805c8e9d6e5016b0691a2b9b25935f6d4 100755 (executable)
--- a/src
+++ b/src
@@ -356,6 +356,12 @@ src fast-import [-p]
    in RFC-822-style headers on log comments unless the -p (plain) option
    is given, in which case this metadata is discarded.
 
+src release ['file'...]
+   Release locks on files.  This is never necessary in a normal workflow,
+   which will be repeated edit-commit cycles, but it may be handy if you
+   have to interoperate with other tools that expect RCS masters to be
+   in their normal (unlocked) stare.
+
 The omission of 'src remove' is a deliberate speed bump.
 """
 
@@ -720,7 +726,7 @@ def filecmd(legend, hook, args):
     if not os.path.exists(source):
         croak("I see no '%s' here." % source)
     elif not os.path.exists(backend.master(source)):
-        croak("%s is not registered, skipping." % source)
+        croak("%s is not registered, skipping" % source)
     elif os.path.exists(backend.master(target)):
         croak("%s is registered, I won't step on it" % source)
     elif os.path.exists(target):
@@ -736,6 +742,19 @@ def copy_method(*args):
     "Copy a file and its history."
     filecmd("copy", backend.copy, args)
 
+def release_method(*args):
+    "Release locks."
+    (revspec, args) = preamble(legend, args)
+    if revspec is not None:
+        croak("release doesn't take a revision spec")
+    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, skipping" % arg)
+        else:
+            backend.release(arg)
+
 def ls_method(*args):
     "List registered files."
     if args:
@@ -841,6 +860,7 @@ dispatch = {
     "cp":          copy_method,
     "fast-export": fast_export_method,
     "fast-import": fast_import_method,
+    "release":     release_method,
 }
 
 class RCS:
@@ -918,7 +938,7 @@ class RCS:
         do_or_die("cp {0} {1} && cp {2} {3}".format(source, target,
                                                     self.master(source),
                                                     self.master(target))) 
-    def diff(diffspec1, diffspec2, diffopts, arg):
+    def diff(self, diffspec1, diffspec2, diffopts, arg):
         "Report a diff."
         # The || : suppresses the error return from diff(1)
         if diffspec1:
@@ -926,6 +946,9 @@ class RCS:
         if diffspec2:
             diffspec2 = "-r" + diffspec1
         do_or_die("rcsdiff -q {0} {1} {2} || :".format(diffspec, diffopts, arg),loud=True)
+    def release(self, arg):
+        "Release locks."
+        do_or_die("rcs -q -u {0},v".format(arg))
 
 if __name__ == "__main__":    
     command = list(sys.argv[1:])
diff --git a/src.asc b/src.asc
index 66cf44a442614ec37d652dc3a918be723b69fe13..e6af113efaae981669fec5d4a88f3bc8fda55c94 100644 (file)
--- a/src.asc
+++ b/src.asc
@@ -109,6 +109,12 @@ src fast-import [-p]::
    in RFC-822-style headers on log comments unless the -p (plain) option
    is given, in which case this metadata is discarded.
 
+src release ['file'...]::
+   Release locks on files.  This is never necessary in a normal workflow,
+   which will be repeated edit-commit cycles, but it may be handy if you
+   have to interoperate with other tools that expect RCS masters to be
+   in their normal (unlocked) stare.
+
 The omission of 'src remove' is a deliberate speed bump.
 
 If no files are specified, all eligible files are operated on in sequence.