]> thyrsus.com Git - src.git/commitdiff
Clarify some terminology. And get closer to branching.
authorEric S. Raymond <esr@thyrsus.com>
Mon, 10 Nov 2014 18:42:59 +0000 (13:42 -0500)
committerEric S. Raymond <esr@thyrsus.com>
Mon, 10 Nov 2014 18:42:59 +0000 (13:42 -0500)
src
src.asc

diff --git a/src b/src
index 5b32d7747a4e14d079ce1af2a36f707849b43477..1d54bd3f7677086db5373277c9dcf3e70c99162b 100755 (executable)
--- a/src
+++ b/src
@@ -245,12 +245,12 @@ src ls
    List all registered files.
 
 src move 'old' 'new'
-   Rename a file and its master. Refuses to step on existing files or masters.
-   'mv' and 'rename' are synonyms.
+   Rename a workfile and its history. Refuses to step on existing
+   workfiles or histories.  'mv' and 'rename' are synonyms.
 
 src copy 'old' 'new'
-   Copy a file and its master. Refuses to step on existing files or masters.
-   'cp' is a synonym.
+   Copy a workfile and its history. Refuses to step on existing files
+   or histories.  'cp' is a synonym.
 
 src fast-export ['revision-range'] ['file'...]
    Export one or more projects to standard output as a git fast-import stream.
@@ -674,7 +674,8 @@ def tag_helper(args, legend, validation_hook, delete_method, set_method):
             set_method(name, revision, metadata, arg)
             if not quiet and len(args) > 1:
                 # FIXME: Misleading message when creating a branch.
-                announce("%s %s = %s in " % (legend, name, revno, arg))
+                #announce("%s %s = %s in " % (legend, name, revno, arg))
+                pass
 
 def tag_method(*args):
     "Inspect, create, and delete tags."
@@ -859,6 +860,8 @@ class RCS:
         def __enter__(self):
             do_or_die("mv {0}/{1},v .".format(repodir, self.name))
         def __exit__(self, extype, value, traceback_unused):
+            if extype and debug > 0:
+                raise extype(value)
             do_or_die("mv {0},v {1}".format(self.name, repodir))
             return True
     def lifter(self, name):
@@ -916,15 +919,25 @@ class RCS:
         croak("branch deletion is not yet supported")
     def set_branch(self, name, revision, metadata, arg):
         "Set the specified branch to be default, creating it if required."
-        def branchfrom(c, p):
-            "Is c a branch child (not direct descendant) of parent p?"
-            c = c.split(".")
-            p = p.split(".")
-            return len(c) == len(p) + 2 and c[len(p):] == p
-        newsib = len(item for item in metatdata.revlist \
-                     if branchfrom(item.revision, baserev))
-        croak("branch change is not yet supported")
-        #do_or_die("rcs -b%s %s" % (revision, name))
+        if name in metadata.symbols:
+            base = metadata.symbols[name]
+        else:
+            def branchfrom(c, p):
+                "Is c a branch child (not direct descendant) of parent p?"
+                c = c.split(".")
+                p = p.split(".")
+                return len(c) == len(p) + 2 and c[len(p):] == p
+            baserev = metadata.current()
+            print "Beginning branch computation from", baserev
+            newsib = len([item for item in metadata.revlist \
+                         if branchfrom(item.revision, baserev)])
+            print "Continuing branch computation"
+            # Use CVS sticky-tag format here? If so, we'd have to do
+            # some unscrambling just above in the non-new case
+            base = baserev + "." + str(newsib)
+            print "New branch", base
+            do_or_die("rcs -n{0}:{1} {2}".format(name, base, arg), loud=True)
+        do_or_die("rcs -b%s %s" % (base, arg), loud=True)
     def move(self, source, target):
         "Move a file and its history."
         do_or_die("mv {0} {1} && mv {2} {3}".format(source, target,
diff --git a/src.asc b/src.asc
index cbb322de899f06c88eb34be20e1002aa9c8501dd..f8c6f1cbcae83a0cf93c8b090cba65ecb4d2aa95 100644 (file)
--- a/src.asc
+++ b/src.asc
@@ -96,8 +96,8 @@ src ls::
    List all registered files.
 
 src rename 'old' 'new'::
-   Rename a file and its master. Refuses to step on existing files or masters.
-   'mv' and 'rename' are synonyms.
+   Rename a workfile and its history. Refuses to step on existing
+   workfiles or histories. 'mv' and 'rename' are synonyms.
 
 src copy 'old' 'new'::
    Copy a file and its master. Refuses to step on existing files or masters.