Support external diff programs

Bug #247976 reported by Nicholas Allen
12
This bug affects 1 person
Affects Status Importance Assigned to Milestone
QBzr
Fix Released
Wishlist
Gary van der Merwe

Bug Description

QBzr should support invoking external diff commands and configuring this in an easy manner. The command could have variables (eg %left %right) that represent paths to the files that should appear on the left and right side in the external program. QBzr should use the configured diff viewer whenever a diff is asked for (e.g when double clicking file in commit dialog etc).

Related branches

Revision history for this message
Alexander Belchenko (bialix) wrote :

Nicholas, I'm not quite understand your request. Can we start new discussion on this topic at QBzr google group (http://groups.google.com/group/qbzr)?

Changed in qbzr:
status: New → Incomplete
Revision history for this message
Alexander Belchenko (bialix) wrote :
Changed in qbzr:
importance: Undecided → Wishlist
status: Incomplete → Confirmed
Revision history for this message
Alexey Stukalov (astukalov) wrote :

Thinking of an implementation: it would be nice to be able to configure the context menus in qlog/qcommit and attach bazaar commands to menu items. There is support of external diffs via Bazaar plugins, so calling some bazaar command would be all that required - just passing the same arguments that are sent to qdiff now.

Revision history for this message
Gary van der Merwe (garyvdm) wrote :

I have been working on this. My branch is here: https://code.launchpad.net/~qbzr-dev/qbzr/extdiff . Sorry I did not mention this earlier. I was not aware of this bug. I've got an updated version which I'll push later today.

Changed in qbzr:
assignee: nobody → garyvdm
Revision history for this message
Alexey Stukalov (astukalov) wrote :

Gary, you might be interested in this: https://code.launchpad.net/~astukalov/bzr-difftools/modes_n_metaargs
It's and extension of difftools plugin, that provides more flexibility in defining how the external should be called. The goal is to be able to fully specify how to start external difftool from bazaar's command line, so that virtually any diff tool could be supported via bazaar's alias.

Revision history for this message
Gary van der Merwe (garyvdm) wrote :

After using my branch for a while, I've abandoned it. The reason why I want this is to be able to revert certain parts of a file in the working tree using a diff program that allow editing, such as meld, The only way to get qdiff to diff the working tree, is from the command line, In that case, I might as well use diff --using...

Changed in qbzr:
assignee: garyvdm → nobody
Revision history for this message
Nicholas Allen (nick-allen) wrote :

I don't understand why the only way to diff the working tree is from the command line but even if it is couldn't qbzr just invoke the necessary command itself (eg run "bzr diff --using meld some_file.txt"). I guess qbzr could detect what kind of diff plugins are supported with the --using option and then offer these in the context menu.

I think this feature is extremely important. Have you abandoned the feature or just the implementation in your branch?

Revision history for this message
Gary van der Merwe (garyvdm) wrote :

Nicholas Allen wrote:
>I think this feature is extremely important. Have you abandoned the feature or just the implementation in your branch?

The feature. I just never use it.

Revision history for this message
Gary van der Merwe (garyvdm) wrote :

Hmm - I've changed my mind. Will work on this soon.

Changed in qbzr:
assignee: nobody → garyvdm
status: Confirmed → In Progress
Revision history for this message
Greg (gregspecialsource) wrote :

This is a most critical feature to me, so much appreciation if you can get this implemented.

I gather the original request was:
1) Allow custom diff / merge tool to be configured in the settings menu.
2) Allow diff operation to call the merge style tool in an editable way so a user can modify or revert parts of their code before committing.

(2) Is specifically useful to me and not present in my previous VCS: Perforce. I tend to fix a bug or implement a feature and diff before each commit. At that time, I often find a bit of debugging code or unnecessary change that must be reverted. The full merge tool would otherwise only launch for a complex integration.

Revision history for this message
Gary van der Merwe (garyvdm) wrote : Re: [Bug 247976] Re: Support external diff programs

On Tue, Jan 27, 2009 at 4:21 PM, Greg <email address hidden> wrote:
> I gather the original request was:
> 1) Allow custom diff / merge tool to be configured in the settings menu.
> 2) Allow diff operation to call the merge style tool in an editable way so a user can modify or revert parts of their code before committing.

Yes - Thats the plan. I'm very close. I got need to find some time to
finish it off.

Revision history for this message
Nicholas Allen (nick-allen) wrote :

Great! This is a killer feature I think. I look forward to trying it out.

Revision history for this message
Gary van der Merwe (garyvdm) wrote :

Done! :-)

I highly recommend using bzr-difftools. This provides the following improvements:
* If you diff the something against the working tree, it passed the path of the working tree to the ext diff app, and not to a path that contains a copy of the working tree (like the std bzr behavior.) This means you can use this to revert justs parts of a file.

* It runs your ext diff once for the tree, rather than once for each changed file. Much more usable.

However - you will encounter an error if you try view a diff across different branches, and you have difftools installed. This is due to bug 238867.

Changed in qbzr:
status: In Progress → Fix Committed
Revision history for this message
Nicholas Allen (nick-allen) wrote :

This is great! It works exactly how I want it. One question though: when configuring the diff viewer in qconfig dialog is it possible to specify command arguments using %left %right?

Changed in qbzr:
milestone: none → 0.9.7
Changed in qbzr:
status: Fix Committed → Fix Released
Revision history for this message
Greg (gregspecialsource) wrote :

Please excuse my ignorance Gary (or Nicholas), but I am trying to get Diffuse (http://diffuse.sourceforge.net/) to work with Tortoise Bazaar.

My command line would normally look something like:

"C:\Program Files\Diffuse\diffuse.pyw" "c:/test1.txt" "c:/test2.txt"

No matter why I've tried in the 'Command' box, no application appears.

Revision history for this message
Mark Hammond (mhammond) wrote :

Executing a .pyw will invoke pythonw.exe, which has the sad side-effect of discarding any exception text and silently exiting on error. You may like to temporarily change the cmdline to something like:

% c:\path\to\python.exe -i "C:\Program Files\Diffuse\diffuse.pyw" "c:/test1.txt" "c:/test2.txt"

and the app should start with a console, and remain open at an interactive prompt after it terminates. I expect you will see an exception which should point you in the right direction. If that is the case, it can probably be consider a bug in diffuse that such errors are silently discarded in a 'pythonw.exe' environment.

Revision history for this message
Gary van der Merwe (garyvdm) wrote :

There was a bug in my code, where if there was an error, that error was not displayed. This is now fixed in trunk. I know some people were having difficulties using this. I hope that this recent fix will make things easier.

Revision history for this message
Nicholas Allen (nick-allen) wrote :

This was working fine until I updated today (28/04/09). Now if I double click a modified file in the commit dialog I get a window with this error:

bzr: ERROR: exceptions.TypeError: run() got an unexpected keyword argument 'new'

Traceback (most recent call last):
  File "/usr/local/lib/python2.6/dist-packages/bzrlib/commands.py", line 727, in exception_to_return_code
    return the_callable(*args, **kwargs)
  File "/usr/local/lib/python2.6/dist-packages/bzrlib/commands.py", line 922, in run_bzr
    ret = run(*run_argv)
  File "/usr/local/lib/python2.6/dist-packages/bzrlib/commands.py", line 559, in run_argv_aliases
    return self.run(**all_cmd_args)
  File "/home/nick/.bazaar/plugins/qbzr/lib/commands.py", line 753, in run
    commands.run_bzr(argv)
  File "/usr/local/lib/python2.6/dist-packages/bzrlib/commands.py", line 922, in run_bzr
    ret = run(*run_argv)
  File "/usr/local/lib/python2.6/dist-packages/bzrlib/commands.py", line 559, in run_argv_aliases
    return self.run(**all_cmd_args)
  File "/home/nick/.bazaar/plugins/difftools/__init__.py", line 78, in run
    return Controller().run(*args, **kwargs)
TypeError: run() got an unexpected keyword argument 'new'

bzr 1.15dev on python 2.6.2 (linux2)
arguments: ['/usr/local/bin/bzr', 'qsubprocess', '"diff" "--using=diffmerge" -r revid:<email address hidden> "--new=file:///home/nick/projects/bitwig/devel/" "--old=file:///home/nick/projects/bitwig/devel/" "rapid_model/lib/java/src/com/bitwig/rapid_model/reflection/OneToOneRelationshipDefinition.java"']
encoding: 'UTF-8', fsenc: 'UTF-8', lang: 'en_GB.UTF-8'
plugins:
  bzrtools /home/nick/.bazaar/plugins/bzrtools [1.14]
  difftools /home/nick/.bazaar/plugins/difftools [0.91]
  launchpad /usr/local/lib/python2.6/dist-packages/bzrlib/plugins/launchpad [unknown]
  mirror /home/nick/.bazaar/plugins/mirror [unknown]
  netrc_credential_store /usr/local/lib/python2.6/dist-packages/bzrlib/plugins/netrc_credential_store [unknown]
  qbzr /home/nick/.bazaar/plugins/qbzr [0.10dev]
  rebase /home/nick/.bazaar/plugins/rebase [0.4.1]
  search /home/nick/.bazaar/plugins/search [1.7dev]
  svn /home/nick/.bazaar/plugins/svn [0.5.4]
  webdav /home/nick/.bazaar/plugins/webdav [1.12]
  xmloutput /home/nick/.bazaar/plugins/xmloutput [0.5]
*** Bazaar has encountered an internal error.
    Please report a bug at https://bugs.launchpad.net/bzr/+filebug
    including this traceback, and a description of what you
    were doing when the error occurred.

Revision history for this message
Gary van der Merwe (garyvdm) wrote :

Very sorry about that. I did not test my changes together with the difftools plugin, and I forgot that difftools does not support the --new and --old arguments. It's fixed now.

Revision history for this message
Greg (gregspecialsource) wrote :

I'm back, trying out v1.14.1. I'm still having no success launching an external diff program.

Now using Diffuse v0.3.3, my command line should simply be:
diffuse "c:/test1.txt" "c:/test2.txt"

However this produces no result. No app launch, no error, nothing.

I still have not located documentation on how to configure the command line. Do I use %1 %2, %left %right, or is the external app expected to accept two or three file names after any flags? All documentation seems to point to the classic bzr commands.
I am not modifying TortoiseBZR nor do I have any desire to. I presume I do not need further plugins to obtain this behavior.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.