]> thyrsus.com Git - src.git/commitdiff
It breaks when listing branches, but I know why.
authorEric S. Raymond <esr@thyrsus.com>
Mon, 10 Nov 2014 19:11:57 +0000 (14:11 -0500)
committerEric S. Raymond <esr@thyrsus.com>
Mon, 10 Nov 2014 19:11:57 +0000 (14:11 -0500)
src

diff --git a/src b/src
index 1d54bd3f7677086db5373277c9dcf3e70c99162b..0de17165e395874c434ecd6583f2db3e2551fbf4 100755 (executable)
--- a/src
+++ b/src
@@ -174,7 +174,7 @@ class History:
         croak("{0} has no revno {1}".format(self.name, revno))
     def isbranch(self, symbol):
         "Is this a branch symbol?"
-        return ".0." in symbol
+        return ".0" in symbol
 
 def help_method(*args):
     "Summarize src commands, or (with argument) show help for a single command."
@@ -641,9 +641,9 @@ def tag_helper(args, legend, validation_hook, delete_method, set_method):
                 if legend == "branch":
                     sys.stdout.write("%s\n" % metadata.branch)
                 for (key, value) in metadata.symbols.items():
-                    if legend == "branch" and key == branch.metadata:
+                    if legend == "branch" and key == metadata.branch:
                         continue
-                    if metadata.isbranch(arg) == (legend == "branch"):
+                    if metadata.isbranch(value) == (legend == "branch"):
                         sys.stdout.write("%4d\t%s\n" % (metadata.rcs_to_revno(value),key))
             return
         if args[0] in ("-r", "rename"):
@@ -982,10 +982,9 @@ class RCS:
                             sys.stderr.write("\t-> symbols\n")
                         state = "symbols"
                     elif line.startswith("branch:"):
-                        if not line.strip()[7:]:
+                        branch = line.split(":")[1].strip()
+                        if not branch:
                             metadata.branch = "trunk"
-                        else:
-                            croak("non-trunk branches are not yet supported.")
                     elif line.startswith("----------------------------"):
                         if debug >= DEBUG_PARSE:
                             sys.stderr.write("\t-> logheader\n")
@@ -1037,6 +1036,14 @@ class RCS:
                         break
                     elif metadata.revlist:
                         metadata.revlist[-1].log += line
+            # Now that we have the symbol table... 
+            if metadata.branch != "trunk":
+                for (k, v) in metadata.symbols.items():
+                    if v == metadata.branch:
+                        metadata.branch = k
+                        break
+                else:
+                    croak("unrecognized branch ID '%s'" % branch)
             for item in metadata.revlist:
                 item.revno = maxrevno - item.revno
             if debug >= DEBUG_PARSE: