summary refs log tree commit diff
path: root/Functions
diff options
context:
space:
mode:
authorFrank Terbeck <bewater@users.sourceforge.net>2011-03-30 20:07:05 +0000
committerFrank Terbeck <bewater@users.sourceforge.net>2011-03-30 20:07:05 +0000
commitae6fb299f33e8dcffeb18787b4a041f47f17cab5 (patch)
tree166160838567bb3b8c19501bdb7f18606c2f9b8c /Functions
parentc9b0a25bb7488c0e2b19b9e33f5696c09f3f25de (diff)
downloadzsh-ae6fb299f33e8dcffeb18787b4a041f47f17cab5.tar.gz
zsh-ae6fb299f33e8dcffeb18787b4a041f47f17cab5.tar.xz
zsh-ae6fb299f33e8dcffeb18787b4a041f47f17cab5.zip
Mike Meyer: 28956, 28957: Add fossil support to vcs_info.
Diffstat (limited to 'Functions')
-rw-r--r--Functions/VCS_Info/Backends/VCS_INFO_detect_fossil13
-rw-r--r--Functions/VCS_Info/Backends/VCS_INFO_get_data_fossil24
2 files changed, 37 insertions, 0 deletions
diff --git a/Functions/VCS_Info/Backends/VCS_INFO_detect_fossil b/Functions/VCS_Info/Backends/VCS_INFO_detect_fossil
new file mode 100644
index 000000000..551528361
--- /dev/null
+++ b/Functions/VCS_Info/Backends/VCS_INFO_detect_fossil
@@ -0,0 +1,13 @@
+## vim:ft=zsh
+## fossil support by: Mike Meyer <mwm@mired.org>
+## Distributed under the same BSD-ish license as zsh itself.
+
+setopt localoptions NO_shwordsplit
+
+[[ $1 == '--flavours' ]] && return 1
+
+VCS_INFO_check_com ${vcs_comm[cmd]} || return 1
+vcs_comm[detect_need_file]=_FOSSIL_
+VCS_INFO_bydir_detect . || return 1
+
+return 0
diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_fossil b/Functions/VCS_Info/Backends/VCS_INFO_get_data_fossil
new file mode 100644
index 000000000..fd0f8389e
--- /dev/null
+++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_fossil
@@ -0,0 +1,24 @@
+## vim:ft=zsh
+## fossil support by: Mike Meyer (mwm@mired.org)
+## Distributed under the same BSD-ish license as zsh itself.
+
+setopt localoptions extendedglob
+local a b
+local -A fsinfo
+local fshash fsbranch changed merging action
+
+${vcs_comm[cmd]} status |
+   while IFS=: read a b; do
+      fsinfo[${a//-/_}]="${b## #}"
+   done
+
+fshash=${fsinfo[checkout]%% *}
+fsbranch=${fsinfo[tags]%%, *}
+changed=${(Mk)fsinfo:#(ADDED|EDITED|DELETED|UPDATED)*}
+merging=${(Mk)fsinfo:#*_BY_MERGE*}
+if [ -n "$merging" ]; then
+   action="merging"
+fi
+
+VCS_INFO_formats "$action" "${fsbranch}" "${fsinfo[local_root]}" '' "$changed" "${fshash}" "${fsinfo[repository]}"
+return 0