Lines 20-25
Link Here
|
20 |
DIFF_CONTENTS = 'diff -Nau %s %s' |
20 |
DIFF_CONTENTS = 'diff -Nau %s %s' |
21 |
DIFF_CVS_INTERP = 'diff -Nau %s %s | grep "^[+-][^+-]" | grep -v "# .Header:.*"' |
21 |
DIFF_CVS_INTERP = 'diff -Nau %s %s | grep "^[+-][^+-]" | grep -v "# .Header:.*"' |
22 |
DIFF_WSCOMMENTS = 'diff -Nau %s %s | grep "^[+-][^+-]" | grep -v "^[-+]#" | grep -v "^[-+][:space:]*$"' |
22 |
DIFF_WSCOMMENTS = 'diff -Nau %s %s | grep "^[+-][^+-]" | grep -v "^[-+]#" | grep -v "^[-+][:space:]*$"' |
|
|
23 |
MKTEMP = 'mktemp /tmp/dispatch-conf.merged.%i.XXXXXX' |
23 |
MERGE = 'sdiff --suppress-common-lines --output=%s %s %s' |
24 |
MERGE = 'sdiff --suppress-common-lines --output=%s %s %s' |
24 |
|
25 |
|
25 |
MANDATORY_OPTS = [ 'archive-dir', 'diff', 'pager', 'replace-cvs', 'replace-wscomments' ] |
26 |
MANDATORY_OPTS = [ 'archive-dir', 'diff', 'pager', 'replace-cvs', 'replace-wscomments' ] |
Lines 95-104
Link Here
|
95 |
elif c == 'n': |
96 |
elif c == 'n': |
96 |
break |
97 |
break |
97 |
elif c == 'f': |
98 |
elif c == 'f': |
98 |
merged = '/tmp/dispatch-conf.merged.%i' % (os.getpid (),) |
99 |
merged = commands.getoutput (MKTEMP % (os.getpid ())) |
99 |
print |
100 |
print |
100 |
os.system (MERGE % (merged, conf ['current'], conf ['new'])) |
101 |
os.system (MERGE % (merged, conf ['current'], conf ['new'])) |
101 |
os.rename (merged, conf ['new']) |
102 |
self.replace (merged, conf ['new']) |
102 |
continue |
103 |
continue |
103 |
elif c == 'k': |
104 |
elif c == 'k': |
104 |
os.remove (conf ['new']) |
105 |
os.remove (conf ['new']) |
Lines 132-142
Link Here
|
132 |
except (IOError, os.error), why: |
133 |
except (IOError, os.error), why: |
133 |
print >> sys.stderr, 'dispatch-conf: Error copying %s to %s: %s; fatal' % \ |
134 |
print >> sys.stderr, 'dispatch-conf: Error copying %s to %s: %s; fatal' % \ |
134 |
(curconf, archive, str(why)) |
135 |
(curconf, archive, str(why)) |
|
|
136 |
|
137 |
# this should be changed to shutil.move() when we move to python 2.3 |
135 |
try: |
138 |
try: |
136 |
os.rename (newconf, curconf) |
139 |
shutil.copy2 (newconf, curconf) |
137 |
except (IOError, os.error), why: |
140 |
except (IOError, os.error), why: |
138 |
print >> sys.stderr, 'dispatch-conf: Error renaming %s to %s: %s; fatal' % \ |
141 |
print >> sys.stderr, 'dispatch-conf: Error copying %s to %s: %s; fatal' % \ |
139 |
(newconf, curconf, str(why)) |
142 |
(newconf, curconf, str(why)) |
|
|
143 |
try: |
144 |
os.unlink (newconf) |
145 |
except (IOError, os.error), why: |
146 |
print >> sys.stderr, 'dispatch-conf: Error removing %s: %s; fatal' % \ |
147 |
(newconf, str(why)) |
140 |
break |
148 |
break |
141 |
else: |
149 |
else: |
142 |
print >> sys.stderr, 'dispatch-conf: Error archiving files -- exhausted slots???; fatal' |
150 |
print >> sys.stderr, 'dispatch-conf: Error archiving files -- exhausted slots???; fatal' |