After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 522521 - Supporting list of file pairs to compare on command line
Supporting list of file pairs to compare on command line
Status: VERIFIED FIXED
Product: meld
Classification: Other
Component: general
1.1.x
Other All
: Normal enhancement
: ---
Assigned To: Stephen Kennedy
Stephen Kennedy
Depends on:
Blocks:
 
 
Reported: 2008-03-14 22:36 UTC by Brian Holmes
Modified: 2009-08-15 18:40 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch created by svn diff against r980. (1.33 KB, patch)
2008-03-14 22:39 UTC, Brian Holmes
none Details | Review
Adds --diff and --vc parameters for meld. (1.39 KB, patch)
2008-04-09 02:33 UTC, Brian Holmes
needs-work Details | Review
Adds --diff option that handles variable argument file list. (5.92 KB, patch)
2008-10-01 08:23 UTC, Brian Holmes
none Details | Review
Update of previous patch (3.45 KB, patch)
2008-10-01 16:40 UTC, Kai Willadsen
committed Details | Review

Description Brian Holmes 2008-03-14 22:36:59 UTC
Our SCM tools spits out a list of file pairs to a diff tool on the command line such as the following:

difftool file1.orig file1.new file2.orig file2.new

We'd like to use meld as the main diff tool for our SCM tools but it doesn't yet support this.  I'm proposing we add a command line flag that would support this.  I came up with '-p' or '--pairs' as name for the flag but that is certainly open to suggestions.
Comment 1 Brian Holmes 2008-03-14 22:39:20 UTC
Created attachment 107321 [details] [review]
Patch created by svn diff against r980.
Comment 2 Brian Holmes 2008-03-14 23:51:32 UTC
I was informed by someone that there is a better way for our tools to handle this.  Please see Bug #522529 for the updated proposal and patch.
Comment 3 Stephen Kennedy 2008-03-15 18:00:52 UTC
I like the idea of flags for delimiters. e.g.

meld --diff2 a.old a.new --diff3 a b c --vc ~/dev/a
Comment 4 Brian Holmes 2008-04-09 02:33:10 UTC
Created attachment 108901 [details] [review]
Adds --diff and --vc parameters for meld.

Stephen,

I like the opt delimiter idea as well.  The flags would make it easy for us to write a wrapper script for our file format.  I've created a patch that should do almost what you've suggested.  The only difference is that the --diff parameter is a comma-separated list.  I didn't see an easy way to use flags as delimiters with optparse. 

Example:

  meld --diff a,b  --diff c,d,e --vc ./my/vc/path/  --vc ./my/vc/file


The patch was created against r989.
Comment 5 Stephen Kennedy 2008-04-27 20:35:27 UTC
I think we should use space as delimiter because that is the normal unix way, even though this makes the option handling more difficult. I think optparse has a callback option which would do the trick. A worse but easier option is to use separate --diff2 --diff3 switches.
Comment 6 Stephen Kennedy 2008-09-27 13:10:50 UTC
Brian, any opinion on the two options? Optparse can do variable length args. See
http://docs.python.org/lib/optparse-callback-example-6.html
Comment 7 Brian Holmes 2008-09-30 06:18:01 UTC
I definitely think the variable length args option is best.  I'll submit a patch for this soon.
Comment 8 Brian Holmes 2008-10-01 08:23:08 UTC
Created attachment 119711 [details] [review]
Adds --diff option that handles variable argument file list.

Added --diff option that will take 1 to 3 arguments as files and perform a diff on them in a new tab.  The --diff parameter can be used any number of times.

Example:
  meld --diff a b  --diff a b c  --diff c
Comment 9 Kai Willadsen 2008-10-01 16:40:11 UTC
Created attachment 119729 [details] [review]
Update of previous patch

The previous patch works for me, but adds a lot of spurious whitespace changes. This is just an update of that patch without the whitespace.
Comment 10 Brian Holmes 2008-10-01 18:47:13 UTC
Sorry, vim was set to auto clear trailing whitespace.
Comment 11 Stephen Kennedy 2008-10-02 20:12:26 UTC
Thanks Brian, that's very clean. I applied it to svn.

BTW I changed the "from" imports to the regular style because there was a conflict with copy.copy vs copy.