[TxMt] Mercurial Bundle: Diff Commands

Eike Bernhardt eike+textmate at unorganized.net
Wed May 16 07:29:53 UTC 2007


Hello,

while testing mercurial I noticed that the diff commands in the
Mercurial Bundle behave differently than what I'm used to from the svn
bundle.

When I select a folder in the drawer and issue any diff command using
the subversion bundle, I get a diff for all files under that selected
folder.

The mercurial diff commands always use the currently active file in the
diff commands.

Changing the hg_diff.rb file enables me to select a folder and get a
diff for everything under it:

@@ -6,7 +6,7 @@
 module Mercurial
    def Mercurial.diff_active_file( revision, command )
       hg             = ENV['TM_HG'] || 'hg'
-      target_path    = ENV['TM_FILEPATH']
+      target_path    = ENV['TM_SELECTED_FILE'] || ENV['TM_FILEPATH']
       work_path      = ENV['WorkPath']
       path           = target_path.sub(/^#{work_path}\//, '')
       output_path    = File.basename(target_path) + ".diff"


(patch is attached)

While I'm here .. I had to change all diff commands do something like

(
"${TM_RUBY:=ruby}" -I "$TM_BUNDLE_SUPPORT/" <<END
        require 'hg_diff'
        Mercurial::diff_active_file("-r$rev2 -r$rev1", "Diff Revisions…")
END
) | iconv -t UTF-8 -c

since without the iconv call I'd get empty diff windows (probably
because of incorrectly encoded german special chars inside the generated
diff) -- but I'm not shure if this is just a local problem.

Bye,
  Eike

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: hg_diff.rb.diff
URL: <http://lists.macromates.com/textmate/attachments/20070516/3e3f967d/attachment.diff>


More information about the textmate mailing list