##// END OF EJS Templates
Remove all remaining print statements...
mpm@selenic.com -
r582:df8a5a00 default
parent child Browse files
Show More
@@ -400,22 +400,22 b' def debugcheckdirstate(ui, repo):'
400 for f in dc:
400 for f in dc:
401 state = repo.dirstate.state(f)
401 state = repo.dirstate.state(f)
402 if state in "nr" and f not in m1:
402 if state in "nr" and f not in m1:
403 print "%s in state %s, but not listed in manifest1" % (f, state)
403 ui.warn("%s in state %s, but not in manifest1\n" % (f, state))
404 errors += 1
404 errors += 1
405 if state in "a" and f in m1:
405 if state in "a" and f in m1:
406 print "%s in state %s, but also listed in manifest1" % (f, state)
406 ui.warn("%s in state %s, but also in manifest1\n" % (f, state))
407 errors += 1
407 errors += 1
408 if state in "m" and f not in m1 and f not in m2:
408 if state in "m" and f not in m1 and f not in m2:
409 print "%s in state %s, but not listed in either manifest" % \
409 ui.warn("%s in state %s, but not in either manifest\n" %
410 (f, state)
410 (f, state))
411 errors += 1
411 errors += 1
412 for f in m1:
412 for f in m1:
413 state = repo.dirstate.state(f)
413 state = repo.dirstate.state(f)
414 if state not in "nrm":
414 if state not in "nrm":
415 print "%s in manifest1, but listed as state %s" % (f, state)
415 ui.warn("%s in manifest1, but listed as state %s" % (f, state))
416 errors += 1
416 errors += 1
417 if errors:
417 if errors:
418 print ".hg/dirstate inconsistent with current parent's manifest"
418 ui.warn(".hg/dirstate inconsistent with current parent's manifest\n")
419 sys.exit(1)
419 sys.exit(1)
420
420
421 def debugdumpdirstate(ui, repo):
421 def debugdumpdirstate(ui, repo):
@@ -424,27 +424,27 b' def debugdumpdirstate(ui, repo):'
424 keys = dc.keys()
424 keys = dc.keys()
425 keys.sort()
425 keys.sort()
426 for file in keys:
426 for file in keys:
427 print "%s => %c" % (file, dc[file][0])
427 ui.write("%c %s\n" % (dc[file][0], file))
428
428
429 def debugindex(ui, file):
429 def debugindex(ui, file):
430 r = hg.revlog(hg.opener(""), file, "")
430 r = hg.revlog(hg.opener(""), file, "")
431 print " rev offset length base linkrev"+\
431 ui.write(" rev offset length base linkrev" +
432 " p1 p2 nodeid"
432 " p1 p2 nodeid\n")
433 for i in range(r.count()):
433 for i in range(r.count()):
434 e = r.index[i]
434 e = r.index[i]
435 print "% 6d % 9d % 7d % 6d % 7d %s.. %s.. %s.." % (
435 ui.write("% 6d % 9d % 7d % 6d % 7d %s.. %s.. %s..\n" % (
436 i, e[0], e[1], e[2], e[3],
436 i, e[0], e[1], e[2], e[3],
437 hg.hex(e[4][:5]), hg.hex(e[5][:5]), hg.hex(e[6][:5]))
437 hg.hex(e[4][:5]), hg.hex(e[5][:5]), hg.hex(e[6][:5])))
438
438
439 def debugindexdot(ui, file):
439 def debugindexdot(ui, file):
440 r = hg.revlog(hg.opener(""), file, "")
440 r = hg.revlog(hg.opener(""), file, "")
441 print "digraph G {"
441 ui.write("digraph G {\n")
442 for i in range(r.count()):
442 for i in range(r.count()):
443 e = r.index[i]
443 e = r.index[i]
444 print "\t%d -> %d" % (r.rev(e[4]), i)
444 ui.write("\t%d -> %d\n" % (r.rev(e[4]), i))
445 if e[5] != hg.nullid:
445 if e[5] != hg.nullid:
446 print "\t%d -> %d" % (r.rev(e[5]), i)
446 ui.write("\t%d -> %d\n" % (r.rev(e[5]), i))
447 print "}"
447 ui.write("}\n")
448
448
449 def diff(ui, repo, *files, **opts):
449 def diff(ui, repo, *files, **opts):
450 """diff working directory (or selected files)"""
450 """diff working directory (or selected files)"""
@@ -502,15 +502,14 b' def doexport(ui, repo, changeset, seqno,'
502 else:
502 else:
503 fp = sys.stdout
503 fp = sys.stdout
504
504
505 print >> fp, "# HG changeset patch"
505 fp.write("# HG changeset patch\n")
506 print >> fp, "# User %s" % change[1]
506 fp.write("# User %s\n" % change[1])
507 print >> fp, "# Node ID %s" % hg.hex(node)
507 fp.write("# Node ID %s\n" % hg.hex(node))
508 print >> fp, "# Parent %s" % hg.hex(prev)
508 fp.write("# Parent %s\n" % hg.hex(prev))
509 print >> fp
510 if other != hg.nullid:
509 if other != hg.nullid:
511 print >> fp, "# Parent %s" % hg.hex(other)
510 fp.write("# Parent %s\n" % hg.hex(other))
512 print >> fp, change[4].rstrip()
511 fp.write(change[4].rstrip())
513 print >> fp
512 fp.write("\n\n")
514
513
515 dodiff(fp, ui, repo, None, prev, node)
514 dodiff(fp, ui, repo, None, prev, node)
516
515
@@ -715,7 +714,7 b' def rawcommit(ui, repo, *flist, **rc):'
715 try: text = open(rc['logfile']).read()
714 try: text = open(rc['logfile']).read()
716 except IOError: pass
715 except IOError: pass
717 if not text and not rc['logfile']:
716 if not text and not rc['logfile']:
718 print "missing commit text"
717 ui.warn("abort: missing commit text\n")
719 return 1
718 return 1
720
719
721 files = relpath(repo, list(flist))
720 files = relpath(repo, list(flist))
@@ -754,10 +753,10 b' def status(ui, repo):'
754 (c, a, d, u) = repo.changes(None, None)
753 (c, a, d, u) = repo.changes(None, None)
755 (c, a, d, u) = map(lambda x: relfilter(repo, x), (c, a, d, u))
754 (c, a, d, u) = map(lambda x: relfilter(repo, x), (c, a, d, u))
756
755
757 for f in c: print "C", f
756 for f in c: ui.write("C ", f, "\n")
758 for f in a: print "A", f
757 for f in a: ui.write("A ", f, "\n")
759 for f in d: print "R", f
758 for f in d: ui.write("R ", f, "\n")
760 for f in u: print "?", f
759 for f in u: ui.write("? ", f, "\n")
761
760
762 def tag(ui, repo, name, rev = None, **opts):
761 def tag(ui, repo, name, rev = None, **opts):
763 """add a tag for the current tip or a given revision"""
762 """add a tag for the current tip or a given revision"""
@@ -520,7 +520,8 b' class localrepository:'
520 ds = ""
520 ds = ""
521 self.opener("undo.dirstate", "w").write(ds)
521 self.opener("undo.dirstate", "w").write(ds)
522
522
523 return transaction.transaction(self.opener, self.join("journal"),
523 return transaction.transaction(self.ui.warn,
524 self.opener, self.join("journal"),
524 self.join("undo"))
525 self.join("undo"))
525
526
526 def recover(self):
527 def recover(self):
@@ -1350,7 +1351,7 b' class localrepository:'
1350 try:
1351 try:
1351 delta = mdiff.patchtext(self.manifest.delta(n))
1352 delta = mdiff.patchtext(self.manifest.delta(n))
1352 except KeyboardInterrupt:
1353 except KeyboardInterrupt:
1353 print "aborted"
1354 self.ui.warn("aborted")
1354 sys.exit(0)
1355 sys.exit(0)
1355 except Exception, inst:
1356 except Exception, inst:
1356 self.ui.warn("unpacking manifest %s: %s\n"
1357 self.ui.warn("unpacking manifest %s: %s\n"
@@ -1392,7 +1393,6 b' class localrepository:'
1392 if n not in filenodes[f]:
1393 if n not in filenodes[f]:
1393 self.ui.warn("%s: %d:%s not in manifests\n"
1394 self.ui.warn("%s: %d:%s not in manifests\n"
1394 % (f, i, short(n)))
1395 % (f, i, short(n)))
1395 print len(filenodes[f].keys()), fl.count(), f
1396 errors += 1
1396 errors += 1
1397 else:
1397 else:
1398 del filenodes[f][n]
1398 del filenodes[f][n]
@@ -54,7 +54,7 b' def up(p):'
54 return up + "/"
54 return up + "/"
55
55
56 def httphdr(type):
56 def httphdr(type):
57 print 'Content-type: %s\n' % type
57 sys.stdout.write('Content-type: %s\n\n' % type)
58
58
59 def write(*things):
59 def write(*things):
60 for thing in things:
60 for thing in things:
@@ -88,7 +88,6 b' def diff(a, b, sorted=0):'
88 try:
88 try:
89 d = sortdiff(a, b)
89 d = sortdiff(a, b)
90 except:
90 except:
91 print a, b
92 raise
91 raise
93 else:
92 else:
94 d = difflib.SequenceMatcher(None, a, b).get_matching_blocks()
93 d = difflib.SequenceMatcher(None, a, b).get_matching_blocks()
@@ -15,13 +15,14 b' import os'
15 import util
15 import util
16
16
17 class transaction:
17 class transaction:
18 def __init__(self, opener, journal, after = None):
18 def __init__(self, report, opener, journal, after = None):
19 self.journal = None
19 self.journal = None
20
20
21 # abort here if the journal already exists
21 # abort here if the journal already exists
22 if os.path.exists(journal):
22 if os.path.exists(journal):
23 raise "journal already exists - run hg recover"
23 raise "journal already exists - run hg recover"
24
24
25 self.report = report
25 self.opener = opener
26 self.opener = opener
26 self.after = after
27 self.after = after
27 self.entries = []
28 self.entries = []
@@ -57,17 +58,17 b' class transaction:'
57 def abort(self):
58 def abort(self):
58 if not self.entries: return
59 if not self.entries: return
59
60
60 print "transaction abort!"
61 self.report("transaction abort!\n")
61
62
62 for f, o in self.entries:
63 for f, o in self.entries:
63 try:
64 try:
64 self.opener(f, "a").truncate(o)
65 self.opener(f, "a").truncate(o)
65 except:
66 except:
66 print "failed to truncate", f
67 self.report("failed to truncate %s\n" % f)
67
68
68 self.entries = []
69 self.entries = []
69
70
70 print "rollback completed"
71 self.report("rollback completed\n")
71
72
72 def rollback(opener, file):
73 def rollback(opener, file):
73 for l in open(file).readlines():
74 for l in open(file).readlines():
General Comments 0
You need to be logged in to leave comments. Login now