From: Eric S. Raymond Date: Fri, 13 Jul 2007 14:53:20 +0000 (+0000) Subject: Now transplants tags. X-Git-Tag: 1.4~2 X-Git-Url: http://thyrsus.com/gitweb/?a=commitdiff_plain;h=93ee717746c9d6742cae48f23f1cd83db6e8731a;p=sccs2rcs.git Now transplants tags. --- diff --git a/sccs2rcs b/sccs2rcs index 95f8c66..20a3394 100755 --- a/sccs2rcs +++ b/sccs2rcs @@ -123,7 +123,7 @@ def progress(msg): logtext += msg + "\n" print msg -def get_output(command): +def do_it(command): global logtext logtext += "$ " + command + "\n" (st, out) = commands.getstatusoutput(command) @@ -135,7 +135,7 @@ def die(msg): record("error recovery begins") for master in os.listdir("SCCS"): if is_sccsmaster(master): - get_output("unget " + master) + do_it("unget " + master) print >>sys.stderr, """\ Danger! Danger! Incomplete history in ./RCS -- remove it. @@ -153,7 +153,7 @@ def warn(msg): logtext += msg + "\n" print >>sys.stderr, msg -def get_output_or_die(command): +def do_it_or_die(command): global logtext logtext += "$ " + command + "\n" (st, out) = commands.getstatusoutput(command) @@ -234,7 +234,7 @@ if __name__ == '__main__': record("%s revisions: %s" % (stem, ", ".join(revisions))) for rev in revisions: cmd = 'prs -d":Dd: :Dm: :Dy: :T: :P:" -r%s SCCS/s.%s' % (rev, stem) - date = get_output_or_die(cmd).strip() + date = do_it_or_die(cmd).strip() try: (day, month, year, tod, author) = date.split() except ValueError: @@ -250,7 +250,7 @@ if __name__ == '__main__': rcsdate = day + " " + months[int(month)-1] + " " + year + " " + tod progress("==> file %s, rev=%s, date=%s, author=%s" \ % (stem, rev, rcsdate, author)) - get_output_or_die("get -e -r%s %s" % (rev, sccsmaster(stem))) + do_it_or_die("get -e -r%s %s" % (rev, sccsmaster(stem))) record("checked out of SCCS") # replace SCCS keywords with RCS keywords @@ -279,7 +279,7 @@ if __name__ == '__main__': cmd = 'ci -f -r%s -d"%s" -w%s -t/dev/null %s' \ % (rev, rcsdate, author, stem) cmd = "echo 'Initial revision.' | " + cmd - get_output_or_die(cmd) + do_it_or_die(cmd) record("initial checkin successful") else: # get RCS lock @@ -290,14 +290,14 @@ if __name__ == '__main__': # Above comment was from Brian Berliner's csh version, # but it's not at all clear why this lock can be allowed # to fail while the trunk one must succeed. - get_output("rcs -l%s %s" % (lckrev, stem)) + do_it("rcs -l%s %s" % (lckrev, stem)) record("got branch lock") else: # need to lock the trunk -- must succeed - get_output_or_die("rcs -l %s" % (stem,)) + do_it_or_die("rcs -l %s" % (stem,)) record("got trunk lock") # Extract the delta message for this revision - deltamsg = get_output_or_die("prs -r$rev SCCS/s.%s" % stem) + deltamsg = do_it_or_die("prs -r$rev SCCS/s.%s" % stem) deltalines = deltamsg.split("\n") while deltalines: line = deltalines[0] @@ -317,13 +317,23 @@ if __name__ == '__main__': except OSError: die("RCS checkin of delta failed") # We're done with this master, unlock it. - get_output_or_die("unget -r%s %s" % (rev, sccsmaster(stem))) + do_it_or_die("unget -r%s %s" % (rev, sccsmaster(stem))) + + # Generate tags from snapshots created by Emacs VC mode + tagnames = os.path.join("SCCS", "VC-names") + if os.path.exists(tagnames): + for line in open(tagnames): + try: + (tag, dummy, filename, rev) = line.split() + except ValueError: + die("tags table in bad format.") + do_it_or_die("rcs -n%s:%s %s" % (tag, rev, os.path.basename(filename))) # Replace all files for which there exist SCCS masters, progress("replacing workfiles...") for filename in os.listdir("SCCS"): if is_sccsmaster(master): - get_output("co " + rcsfile(workfile(master))) + do_it("co " + rcsfile(workfile(master))) progress("done.") # sccs2rcs ends here