1. Éric Araujo
  2. scripts-hg

Commits

Éric Araujo  committed a5a9af6

Rename hgl10nmerge, as it’s not specific to translation branches

  • Participants
  • Parent commits 7704df5
  • Branches default

Comments (0)

Files changed (4)

File README

View file
 to the path of this script (see example in included sample.hgrc file).
 
 
-hgl10nmerge
-===========
+hgddmt
+======
 
 Some use cases are not handled well by classic merge tools, which display panels
 with the different versions of the file to merge (the common base, the newer
 shows you a translated French file in one panel and the newer English page in
 another panel, you cannot easily see what are the changes made in the English
 page: the whole page is different!  To fix this, I wrote this simple script that
-displays the diff of the original file alongside the translated file.  It lets
-you see directly the changes made upstream and apply them as appropriate to your
-translated version.
+displays the diff of the original file alongside the translated file (its name
+means display-diff-merge-tool).  It lets you see directly the changes made
+upstream and apply them as appropriate to your translated version.
 
 To use this script as merge tool, first you should register it in the
 merge-tools section of your .hgrc file (see example in included sample.hgrc
 file), and then you can enable it on the command line:
 
-   $ hg merge default --tool l10nmerge
+   $ hg merge default --tool ddmt
 
 To always use that tool in a specific clone, edit clone/.hg/hgrc and add
-"merge = l10nmerge" in the ui section.
+"merge = ddmt" in the ui section.  It’s also possible to configure this merge
+tool only for certain files; see “hg help merge-tools” for more info.

File hgddmt

View file
+#!/bin/sh
+#                  display-diff-merge-tool
+# This script is a merge tool for Mercurial repositories where files have
+# wholly different contents across branches, for example when using translation
+# branches (see README).  Written by Éric Araujo under GPLv2+.  Some lines
+# taken from Mercurial's hgeditor script, by Matt Mackall and others, GPLv2+.
+
+# set envvar that can be useful in the editor
+REPO="$PWD"; export REPO
+HGTMP=""
+
+cleanup_exit() {
+    rm -rf "$HGTMP"
+}
+
+# Remove temporary files even if we get interrupted
+trap "cleanup_exit" 0 # normal exit
+trap "exit 255" HUP INT QUIT ABRT TERM
+
+HGTMP=$(mktemp -d ${TMPDIR-/tmp}/hgeditor.XXXXXX)
+[ x$HGTMP != x -a -d $HGTMP ] || {
+  echo "$0: could not create temporary directory, exiting" 1>&2
+  exit 1
+}
+
+# Create the diff between other and base
+diff -u $2 $3 > "$HGTMP/diff"
+
+# Display the output file and the diff in a split window
+# (the buftype setting makes vim quit when the output file is closed, even if
+# the diff buffer is not)
+vim -f "$HGTMP/diff" +"set buftype=help" +"vsplit $1" || exit $?
+
+exit $?

File hgl10nmerge

-#!/bin/sh
-# This script is a merge tool for Mercurial repositories using translation
-# branches (see README).  Written by Éric Araujo under GPLv2+.
-# Some lines taken from Mercurial's hgeditor script, by Matt Mackall and
-# others, GPLv2+.
-
-# set envvar that can be useful in the editor
-REPO="$PWD"; export REPO
-HGTMP=""
-
-cleanup_exit() {
-    rm -rf "$HGTMP"
-}
-
-# Remove temporary files even if we get interrupted
-trap "cleanup_exit" 0 # normal exit
-trap "exit 255" HUP INT QUIT ABRT TERM
-
-HGTMP=$(mktemp -d ${TMPDIR-/tmp}/hgeditor.XXXXXX)
-[ x$HGTMP != x -a -d $HGTMP ] || {
-  echo "$0: could not create temporary directory, exiting" 1>&2
-  exit 1
-}
-
-# Create the diff between other and base
-diff -u $2 $3 > "$HGTMP/diff"
-
-# Display the output file and the diff in a split window
-# (the buftype setting makes vim quit when the output file is closed, even if
-# the diff buffer is not)
-vim -f "$HGTMP/diff" +"set buftype=help" +"vsplit $1" || exit $?
-
-exit $?

File sample.hgrc

View file
 editor = path/to/scripts-hg/hgeditor
 
 [merge-tools]
-l10nmerge.executable = path/to/scripts-hg/hgl10nmerge
+ddmt.executable = path/to/scripts-hg/hgddmt
 
 [diff]
 git = on