]> thyrsus.com Git - rcs-fast-import.git/commitdiff
Make the code as little cleaner and quieter.
authorEric S. Raymond <esr@thyrsus.com>
Thu, 11 Nov 2010 14:11:19 +0000 (09:11 -0500)
committerEric S. Raymond <esr@thyrsus.com>
Thu, 11 Nov 2010 14:11:19 +0000 (09:11 -0500)
rcs-fast-import

index cdc2840bccae536f9ea25f371d100244a1f2e42b..ca81c8522f124e0ffb2cc6421eb0ef7dd65522d4 100755 (executable)
@@ -583,7 +583,7 @@ class RCS:
                 if not dryrun:
                     shutil.copy(copyfile, path)
                 responsible = event.authors[0] or event.committer
-                command = "ci -l"
+                command = "ci -q -l"
                 # If we were going to try to match committer or author
                 # email addresses to local names, this would be the place
                 # to do it.  Not a whole lot of point in trying, though.
@@ -611,9 +611,6 @@ class RCS:
         # is check out the tip rev and use it to initialize
         # a new master.
         shutil.copy(RCS.master(source), RCS.master(target))
-    def tag(self, event):
-        "Process a tag event."
-        pass
     def checkout(self, switch):
         "Post-conversion actions."
         pass
@@ -641,43 +638,36 @@ if __name__ == '__main__':
     try:
         with Repository() as repo:
             repo.fast_import(sys.stdin)
-            for event in repo.events:
-                if isinstance(event, Blob) or isinstance(event, Reset) or isinstance(event, Passthrough):
-                    continue
-                elif isinstance(event, Tag):
-                    if verbose:
-                        announce("Tagging %s with %s" % (event.committish, event.name))
-                    vcs.tag(event)
-                elif isinstance(event, Commit):
-                    committables = []
-                    for op in event.fileops:
-                        if op.op == "M":
-                            if verbose:
-                                announce("%5s M %s" % (event.mark, op.path))
-                            committables.append((op.path, op.mode, op.copyname))
-                        elif op.op in ("D", "deleteall"):
-                            # If we delete masters, we lose ability to
-                            # retrieve old versions.
-                            if do_deletes:
-                                if verbose:
-                                    announce("%5s D %s" % (event.mark, op.path))
-                                if not dryrun:
-                                    vcs.remove(op.path)
-                            elif verbose:
-                                announce("%5s D %s ignored" % (event.mark, op.path))
-                        elif op.op == "R":
-                            if verbose:
-                                announce("%5s R '%s' '%s'" % (event.mark, op.source, op.target))
-                            if not dryrun:
-                                vcs.rename(op.source, op.target)
-                        elif op.op == "C":
+            for event in repo.commits():
+                committables = []
+                for op in event.fileops:
+                    if op.op == "M":
+                        if verbose:
+                            announce("%5s M %s" % (event.mark, op.path))
+                        committables.append((op.path, op.mode, op.copyname))
+                    elif op.op in ("D", "deleteall"):
+                        # If we delete masters, we lose ability to
+                        # retrieve old versions.
+                        if do_deletes:
                             if verbose:
-                                announce("%5s C '%s' '%s'" % (event.mark, op.source, op.target))
+                                announce("%5s D %s" % (event.mark, op.path))
                             if not dryrun:
-                                vcs.copy(ops.source, op.target)
-                        else:
-                            raise FatalException("unknown op type %s" % op.op)
-                    vcs.commit(event, committables)
+                                vcs.remove(op.path)
+                        elif verbose:
+                            announce("%5s D %s ignored" % (event.mark, op.path))
+                    elif op.op == "R":
+                        if verbose:
+                            announce("%5s R '%s' '%s'" % (event.mark, op.source, op.target))
+                        if not dryrun:
+                            vcs.rename(op.source, op.target)
+                    elif op.op == "C":
+                        if verbose:
+                            announce("%5s C '%s' '%s'" % (event.mark, op.source, op.target))
+                        if not dryrun:
+                            vcs.copy(ops.source, op.target)
+                    else:
+                        raise FatalException("unknown op type %s" % op.op)
+                vcs.commit(event, committables)
             vcs.checkout(checkout_mode)
         raise SystemExit, 0
     except FatalException, e: