Lines 58-68
Link Here
|
58 |
same_cvs = same_cvs and self.options ['replace-cvs'] == 'yes' |
58 |
same_cvs = same_cvs and self.options ['replace-cvs'] == 'yes' |
59 |
same_wsc = same_wsc and self.options ['replace-wscomments'] == 'yes' |
59 |
same_wsc = same_wsc and self.options ['replace-wscomments'] == 'yes' |
60 |
|
60 |
|
|
|
61 |
mrg = re.sub (r'\._cfg', '._mrg', conf ['new']) |
61 |
if same_file: |
62 |
if same_file: |
62 |
os.unlink (conf ['new']) |
63 |
os.unlink (conf ['new']) |
|
|
64 |
if os.path.exists (mrg): |
65 |
os.unlink (mrg) |
63 |
return False |
66 |
return False |
64 |
elif same_cvs or same_wsc or conf ['dir'] in portage.settings ['CONFIG_PROTECT_MASK'].split (): |
67 |
elif same_cvs or same_wsc or conf ['dir'] in portage.settings ['CONFIG_PROTECT_MASK'].split (): |
65 |
self.replace (conf ['new'], conf ['current']) |
68 |
self.replace (conf ['new'], conf ['current']) |
|
|
69 |
if os.path.exists (mrg): |
70 |
os.unlink (mrg) |
66 |
return False |
71 |
return False |
67 |
else: |
72 |
else: |
68 |
return True |
73 |
return True |
Lines 76-108
Link Here
|
76 |
for conf in confs: |
81 |
for conf in confs: |
77 |
count = count + 1 |
82 |
count = count + 1 |
78 |
|
83 |
|
|
|
84 |
new = conf ['new'] |
85 |
mrg = re.sub (r'\._cfg', '._mrg', new) |
86 |
if os.path.exists (mrg): |
87 |
new = mrg |
88 |
show_new_diff = 0 |
89 |
|
79 |
while 1: |
90 |
while 1: |
80 |
os.system ((self.options ['diff'] + '| %s') % (conf ['current'], conf ['new'], self.options ['pager'])) |
91 |
if show_new_diff: |
|
|
92 |
os.system ((self.options ['diff'] + '| %s') % (conf ['new'], mrg, self.options ['pager'])) |
93 |
show_new_diff = 0 |
94 |
else: |
95 |
os.system ((self.options ['diff'] + '| %s') % (conf ['current'], new, self.options ['pager'])) |
81 |
|
96 |
|
82 |
print |
97 |
print |
83 |
print '>> (%i of %i) -- %s' % (count, len(confs), conf ['current']) |
98 |
print '>> (%i of %i) -- %s' % (count, len(confs), conf ['current']) |
84 |
print '>> q quit, h help, n skip, f fuse/merge, k kill new, s supercede w/new', |
99 |
print '>> q quit, h help, n next, m merge, t toggle-merge, d del-new, u use-new: ', |
85 |
|
100 |
|
86 |
c = getch () |
101 |
c = getch () |
87 |
|
102 |
|
88 |
if c == 'q': |
103 |
if c == 'q': |
89 |
sys.exit (0) |
104 |
sys.exit (0) |
90 |
if c == 'h': |
105 |
if c == 'h': |
91 |
do_help () |
106 |
self.do_help () |
|
|
107 |
continue |
108 |
elif c == 't': |
109 |
if new == mrg: |
110 |
new = conf ['new'] |
111 |
elif os.path.exists (mrg): |
112 |
new = mrg |
92 |
continue |
113 |
continue |
93 |
elif c == 'n': |
114 |
elif c == 'n': |
94 |
break |
115 |
break |
95 |
elif c == 'f': |
116 |
elif c == 'm': |
96 |
merged = '/tmp/dispatch-conf.merged.%i' % (os.getpid (),) |
117 |
merged = '/tmp/dispatch-conf.merged.%i' % (os.getpid (),) |
97 |
print |
118 |
print |
98 |
os.system (MERGE % (merged, conf ['current'], conf ['new'])) |
119 |
os.system (MERGE % (merged, conf ['current'], new)) |
99 |
os.rename (merged, conf ['new']) |
120 |
os.rename (merged, mrg) |
|
|
121 |
new = mrg |
100 |
continue |
122 |
continue |
101 |
elif c == 'k': |
123 |
elif c == 'l': |
|
|
124 |
show_new_diff = 1 |
125 |
continue |
126 |
elif c == 'd': |
102 |
os.remove (conf ['new']) |
127 |
os.remove (conf ['new']) |
|
|
128 |
if os.path.exists (mrg): |
129 |
os.remove (mrg) |
103 |
break |
130 |
break |
104 |
elif c == 's': |
131 |
elif c == 'u': |
105 |
self.replace (conf ['new'], conf ['current']) |
132 |
self.replace (new, conf ['current']) |
|
|
133 |
if os.path.exists (conf ['new']): |
134 |
os.remove (conf ['new']) |
135 |
if os.path.exists (mrg): |
136 |
os.remove (mrg) |
106 |
break |
137 |
break |
107 |
else: |
138 |
else: |
108 |
continue |
139 |
continue |
Lines 172-183
Link Here
|
172 |
def do_help (self): |
203 |
def do_help (self): |
173 |
print; print |
204 |
print; print |
174 |
|
205 |
|
175 |
print ' q -- quit' |
206 |
print ' u -- update current config with new config and continue' |
|
|
207 |
print ' d -- delete new config and continue' |
208 |
print ' n -- skip to next config, leave all intact' |
209 |
print ' m -- interactively merge current and new configs' |
210 |
print ' l -- look at diff between _new_ and merged configs (not current and merged)' |
211 |
print ' t -- toggle new config between merged and pre-merged state' |
176 |
print ' h -- this screen' |
212 |
print ' h -- this screen' |
177 |
print ' n -- next/skip to next config, leave all intact' |
213 |
print ' q -- quit' |
178 |
print ' f -- interactively fuse/merge current and new configs' |
|
|
179 |
print ' k -- kill/remove new config and continue' |
180 |
print ' s -- supercede current config with new and continue' |
181 |
|
214 |
|
182 |
print; print 'press any key to return to diff...', |
215 |
print; print 'press any key to return to diff...', |
183 |
|
216 |
|