def get_output(command):
global logtext
- logtext += "$ " + command
+ logtext += "$ " + command + "\n"
(st, out) = commands.getstatusoutput(command)
logtext += out + "\n"
return out + "\n"
def die(msg):
print >>sys.stderr, "sccs2rcs: fatal error, ", msg
+ progress("error recovery begins")
for filename in os.listdir("."):
if os.path.exists(sccsfile(filename)) and writeable(filename):
get_output("unget " + sccsfile(filename))
def get_output_or_die(command):
global logtext
- logtext += "$ " + command
+ logtext += "$ " + command + "\n"
(st, out) = commands.getstatusoutput(command)
+ logtext += out + "\n"
if st != 0:
die("'%s' failed" % command)
- logtext += out + "\n"
return out + "\n"
if __name__ == '__main__':
revisions.reverse()
# Now use prs to run through the revision list extracting data
- progress("%s revisions: %s\n" % (file, ", ".join(revisions)))
+ progress("%s revisions: %s" % (file, ", ".join(revisions)))
for rev in revisions:
cmd = 'prs -d":Dd: :Dm: :Dy: :T: :P:" -r%s SCCS/s.%s' % (rev, file)
- date = get_output_or_die(cmd)
+ date = get_output_or_die(cmd).strip()
try:
(day, month, year, tod, author) = date.split()
except ValueError:
firsttime = False
if file in initstrings:
cmd = 'ci -f -r%s -d"%s" -w%s -t-%s %s' \
- % (rev, date, author, initstrings[file], file)
+ % (rev, rcsdate, author, initstrings[file], file)
else:
if initstrings:
warn("no description for %s in comments file" % file)
cmd = 'ci -f -r%s -d"%s" -w%s -t/dev/null %s' \
- % (rev, date, author, file)
+ % (rev, rcsdate, author, file)
cmd = "echo 'Initial revision.' | " + cmd
get_output_or_die(cmd)
+ progress("initial checkin successful")
else:
# get RCS lock
revparts = rev.split(".")
# Replace all files for which there exist SCCS masters,
progress("replacing workfiles")
for filename in os.listdir("."):
- if os.exists(sccsfile(filename)):
+ if os.path.exists(sccsfile(filename)):
os.remove(filename)
os.system("co " + file)
print progress("done.")