--- dispatch-conf.orig 2003-02-09 14:45:04.000000000 -0800 +++ dispatch-conf 2003-02-09 15:35:37.000000000 -0800 @@ -58,11 +58,16 @@ same_cvs = same_cvs and self.options ['replace-cvs'] == 'yes' same_wsc = same_wsc and self.options ['replace-wscomments'] == 'yes' + mrg = re.sub (r'\._cfg', '._mrg', conf ['new']) if same_file: os.unlink (conf ['new']) + if os.path.exists (mrg): + os.unlink (mrg) return False elif same_cvs or same_wsc or conf ['dir'] in portage.settings ['CONFIG_PROTECT_MASK'].split (): self.replace (conf ['new'], conf ['current']) + if os.path.exists (mrg): + os.unlink (mrg) return False else: return True @@ -76,33 +81,59 @@ for conf in confs: count = count + 1 + new = conf ['new'] + mrg = re.sub (r'\._cfg', '._mrg', new) + if os.path.exists (mrg): + new = mrg + show_new_diff = 0 + while 1: - os.system ((self.options ['diff'] + '| %s') % (conf ['current'], conf ['new'], self.options ['pager'])) + if show_new_diff: + os.system ((self.options ['diff'] + '| %s') % (conf ['current'], mrg, self.options ['pager'])) + show_new_diff = 0 + else: + os.system ((self.options ['diff'] + '| %s') % (conf ['current'], new, self.options ['pager'])) print print '>> (%i of %i) -- %s' % (count, len(confs), conf ['current']) - print '>> q quit, h help, n skip, f fuse/merge, k kill new, s supercede w/new', + print '>> q quit, h help, n next, m merge, t toggle-merge, d del-new, u use-new: ', c = getch () if c == 'q': sys.exit (0) if c == 'h': - do_help () + self.do_help () + continue + elif c == 't': + if new == mrg: + new = conf ['new'] + elif os.path.exists (mrg): + new = mrg continue elif c == 'n': break - elif c == 'f': + elif c == 'm': merged = '/tmp/dispatch-conf.merged.%i' % (os.getpid (),) print - os.system (MERGE % (merged, conf ['current'], conf ['new'])) - os.rename (merged, conf ['new']) + os.system (MERGE % (merged, conf ['current'], new)) + os.rename (merged, mrg) + new = mrg continue - elif c == 'k': + elif c == 'l': + show_new_diff = 1 + continue + elif c == 'd': os.remove (conf ['new']) + if os.path.exists (mrg): + os.remove (mrg) break - elif c == 's': - self.replace (conf ['new'], conf ['current']) + elif c == 'u': + self.replace (new, conf ['current']) + if os.path.exists (conf ['new']): + os.remove (conf ['new']) + if os.path.exists (mrg): + os.remove (mrg) break else: continue @@ -172,12 +203,14 @@ def do_help (self): print; print - print ' q -- quit' + print ' u -- update current config with new config and continue' + print ' d -- delete new config and continue' + print ' n -- skip to next config, leave all intact' + print ' m -- interactively merge current and new configs' + print ' l -- look at diff between _new_ and merged configs (not current and merged)' + print ' t -- toggle new config between merged and pre-merged state' print ' h -- this screen' - print ' n -- next/skip to next config, leave all intact' - print ' f -- interactively fuse/merge current and new configs' - print ' k -- kill/remove new config and continue' - print ' s -- supercede current config with new and continue' + print ' q -- quit' print; print 'press any key to return to diff...',