|
View:
New views
3 Messages
—
Rating Filter:
Alert me
|
|
|
Patch for meld to handle multiple diffs from command lineHello. I think I've developed a patch for meld that would allow it to handle multiple comparisons from one command line execution. The idea is that the current usage is kept the same, but multiple diffs can be specified by separating each one with a "-" in the argument list. So for example, you could run:
meld file1.orig file1.mine - file2.orig file2.mine - file3.orig file3.mine And it would show up with a tab for each of those comparisons. Patch is attached. Feedback is welcome; just thought I would share my contribution. -Ken [meld-multiple-diffs-patch.patch] diff -u -r meld.orig/meldapp.py meld/meldapp.py --- meld.orig/meldapp.py 2009-09-16 17:19:16.000000000 -0600 +++ meld/meldapp.py 2009-09-16 18:15:40.000000000 -0600 @@ -842,7 +842,10 @@ %prog <dir> Start with VC browser in 'dir' %prog <file> Start with VC diff of 'file' %prog <file> <file> [file] Start with 2 or 3 way file comparison - %prog <dir> <dir> [dir] Start with 2 or 3 way directory comparison""", + %prog <dir> <dir> [dir] Start with 2 or 3 way directory comparison + + Multiple diffs may be separated with "-". + """, description="""Meld is a file and directory comparison tool.""", version="%prog "+version) parser.add_option("-L", "--label", action="append", default=[], help=_("Set label to use instead of file name")) @@ -854,30 +857,42 @@ app = MeldApp() tab = None - - if len(args) == 0: - pass - - elif len(args) == 1: - a = args[0] - if os.path.isfile(a): - doc = vcview.VcView(app.prefs) - def cleanup(): - app.scheduler.remove_scheduler(doc.scheduler) - app.scheduler.add_task(cleanup) - app.scheduler.add_scheduler(doc.scheduler) - doc.set_location( os.path.dirname(a) ) - doc.connect("create-diff", lambda obj,arg: app.append_diff(arg) ) - doc.run_diff([a]) - else: - tab = app.append_vcview( [a] ) - - elif len(args) in (2,3): - tab = app.append_diff(args) + + if '-' in args: + ## + ## There are multiple diffs, separated by '-' + argParts = [] + working = args + while '-' in working: + argParts.append(working[:working.index('-')]) + working = working[working.index('-')+1:] + argParts.append(working) else: - app.usage( _("Wrong number of arguments (Got %i)") % len(args)) - - if tab: - tab.set_labels( options.label ) + argParts = [args] + + for args in argParts: + if len(args) == 0: + pass + elif len(args) == 1: + a = args[0] + if os.path.isfile(a): + doc = vcview.VcView(app.prefs) + def cleanup(): + app.scheduler.remove_scheduler(doc.scheduler) + app.scheduler.add_task(cleanup) + app.scheduler.add_scheduler(doc.scheduler) + doc.set_location( os.path.dirname(a) ) + doc.connect("create-diff", lambda obj,arg: app.append_diff(arg) ) + doc.run_diff([a]) + else: + tab = app.append_vcview( [a] ) + + elif len(args) in (2,3): + tab = app.append_diff(args) + else: + app.usage( _("Wrong number of arguments (Got %i)") % len(args)) + + if tab: + tab.set_labels( options.label ) app.main() Binary files meld.orig/meldapp.pyc and meld/meldapp.pyc differ _______________________________________________ meld-list mailing list meld-list@... http://mail.gnome.org/mailman/listinfo/meld-list |
|
|
Re: Patch for meld to handle multiple diffs from command line2009/9/17 Ken Kinder <kkinder@...>:
> Hello. I think I've developed a patch for meld that would allow it to handle > multiple comparisons from one command line execution. The idea is that the > current usage is kept the same, but multiple diffs can be specified by > separating each one with a "-" in the argument list. So for example, you > could run: > > meld file1.orig file1.mine - file2.orig file2.mine - file3.orig > file3.mine > > And it would show up with a tab for each of those comparisons. > > Patch is attached. Feedback is welcome; just thought I would share my > contribution. While there's nothing wrong with your patch, you should already be able to do this with the --diff command line option. Usage should be similar: meld --diff file1.orig file1.mine --diff file2.orig file2.mine --diff file3.orig Does this solve the same problem, or are you angling for something different? Kai _______________________________________________ meld-list mailing list meld-list@... http://mail.gnome.org/mailman/listinfo/meld-list |
|
|
Re: Patch for meld to handle multiple diffs from command lineOn Wed, Sep 16, 2009 at 7:21 PM, Kai Willadsen <kai.willadsen@...> wrote:
While there's nothing wrong with your patch, you should already be Oh, I didn't notice there was a 1.3. That does solve my problem, I just didn't see it yet. Thanks! _______________________________________________ meld-list mailing list meld-list@... http://mail.gnome.org/mailman/listinfo/meld-list |
| Free embeddable forum powered by Nabble | Forum Help |