diff options
author | Paweł Forysiuk <tuxator@o2.pl> | 2015-06-04 19:48:43 +0200 |
---|---|---|
committer | Paweł Forysiuk <tuxator@o2.pl> | 2015-06-04 19:48:43 +0200 |
commit | a31192d4dbb2a1e8fa5931e5871596d03d42e44b (patch) | |
tree | 594ee5412f3bda4dbaa5e6045c044ed4e45296d3 /tools | |
parent | 09509be9b2727204ad1a5fde4f0eda23897863b3 (diff) | |
download | midori-a31192d4dbb2a1e8fa5931e5871596d03d42e44b.tar.gz |
Setup bzr with some helpful settings and plugins
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/sanitize_bzr.sh | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/tools/sanitize_bzr.sh b/tools/sanitize_bzr.sh new file mode 100755 index 00000000..94eb0f22 --- /dev/null +++ b/tools/sanitize_bzr.sh @@ -0,0 +1,66 @@ +#!/bin/bash +BZR_PLUGINS_DIR=${HOME}/.bazaar/plugins/ +if [ ! -d $BZR_PLUGINS_DIR ]; then + mkdir -p $BZR_PLUGINS_DIR +fi + cd $BZR_PLUGINS_DIR + + echo + echo "Fetching pager plugin..." + bzr branch lp:bzr-pager pager + + echo + echo "Fetching bisect plugin..." + bzr branch lp:bzr-bisect bisect + +# http://blog.mariadb.org/bzr-hacks-and-tricks/ + echo + echo "Fetching diffoptions plugin..." + mkdir diffoptions + cat >> diffoptions/__init__.py << _EOF + #!/usr/bin/env python + +"""global bzr diff options""" + +version_info = (0, 0, 1) + +from bzrlib import branch +from bzrlib import diff +from bzrlib import errors + +def get_differ(tree): + try: + root = tree.id2path(tree.get_root_id()) + br = branch.Branch.open_containing(root)[0] + diff_options = br.get_config().get_user_option('diff_options') + if diff_options is not None: + opts = diff_options.split() + def diff_file(olab, olines, nlab, nlines, to_file, path_encoding=None): + diff.external_diff(olab, olines, nlab, nlines, to_file, opts) + return diff_file + except (errors.NoSuchId, NotImplementedError): + pass + return None + +old_init = diff.DiffText.__init__ + +def new_init(self, old_tree, new_tree, to_file, path_encoding='utf-8', + old_label='', new_label='', differ=diff.internal_diff): + + if differ == diff.internal_diff: + differ = get_differ(old_tree) or get_differ(new_tree) or diff.internal_diff + + old_init(self, old_tree, new_tree, to_file, path_encoding, + old_label, new_label, differ) + +diff.DiffText.__init__ = new_init +_EOF + +cat <<_EOF + +Add this to your ~/.bazaar/bazaar.conf + +[DEFAULT] +diff_options='-u -F ^[[:alpha:]$_].*[^:]$' + +_EOF |