Changege the untracked behavior to the same as git. Fix branch display bug while browsing deep fossil repositories

This commit is contained in:
Étienne Deparis 2013-01-05 23:03:26 +01:00
parent a10d18c1bf
commit 2e8718f1d0
3 changed files with 24 additions and 17 deletions

View File

@ -58,12 +58,12 @@ preserving the first two directories;
* the name of the current branch if you are in a version control repository
(git, mercurial or subversion), in green if everything is up to date, in red if
there is changes, in yellow if there is pending commits to push;
* the number of added/deleted lines, if changes have been made and the number
of pending commits, if any;
* the number of added/deleted lines (git) or files (fossil), if
changes have been made and the number of pending commits, if any;
* a star if there is some untracked files in the repository;
* the error code of the last command, if it has failed in some way;
* a smart mark: ± for git directories, ☿ for mercurial, ‡ for svn, $ for simple
user, a red # for root.
* a smart mark: ± for git directories, ☿ for mercurial, ‡ for svn,
for fossil, $ for simple user, a red # for root.
You can temporarily deactivate the liquid prompt and come back to your previous
one by typing `prompt_off`. Use `prompt_on` to bring it back. You can deactivate
@ -122,6 +122,7 @@ building:
* `LP_ENABLE_GIT`, if you want to have git informations
* `LP_ENABLE_SVN`, if you want to have subversion informations
* `LP_ENABLE_HG`, if you want to have mercurial informations
* `LP_ENABLE_FOSSIL`, if you want to have fossil informations
* `LP_ENABLE_VCS_ROOT`, if you want to show VCS informations with root account
Note that if required commands are not installed, enabling the
@ -160,6 +161,7 @@ Available features:
* `LP_GIT` git
* `LP_HG` mercurial
* `LP_SVN` subversion
* `LP_FOSSIL` fossil
* `LP_ERR` last error code
* `LP_MARK` prompt mark
@ -221,7 +223,7 @@ Set to a null string "" if you do not want color.
* `LP_COLOR_UP` repository is up to date / a push have been made
* `LP_COLOR_COMMITS` some commits have not been pushed
* `LP_COLOR_CHANGES` there is some changes to commit
* `LP_COLOR_DIFF` number of lines impacted by current changes
* `LP_COLOR_DIFF` number of lines or files impacted by current changes
* Battery
* `LP_COLOR_CHARGING_ABOVE` charging and above threshold
* `LP_COLOR_CHARGING_UNDER` charging but under threshold
@ -239,6 +241,7 @@ Special characters:
* `LP_MARK_HG` (default: "☿") prompt mark in hg repositories
* `LP_MARK_SVN` (default: "‡") prompt mark in svn repositories
* `LP_MARK_GIT` (default: "±") prompt mark in git repositories
* `LP_MARK_FOSSIL` (default: "⌘") prompt mark in fossil repositories
* `LP_MARK_UNTRACKED` (default: "*") if git has untracked files
@ -254,4 +257,3 @@ the display of the liquid prompt.
* Subversion repository cannot display commits to be pushed, this is a
limitation of the Subversion versionning model.
* The proxy detection only uses the `$http_proxy` environment variable.

View File

@ -742,7 +742,7 @@ _lp_fossil_branch()
[[ "$LP_ENABLE_FOSSIL" != 1 ]] && return
# first, are we in an open fossil repository?
if [[ -e _FOSSIL_ || -e .fslckout ]] ; then
if fossil info &>/dev/null ; then
local branch
branch=$(fossil status 2>/dev/null | grep tags: | cut -c17-)
if [[ -n "$branch" ]] ; then
@ -756,11 +756,11 @@ _lp_fossil_branch()
# Set a color depending on the branch state:
# - green if the repository is clean
# - red if there is changes to commit
# - yellow if the branch has no tag name
#
# Add the number of impacted files with a
# + when files are ADDED or EDITED
# - when files are DELETED
# ? when files are not part of the current checkout
_lp_fossil_branch_color()
{
[[ "$LP_ENABLE_FOSSIL" != 1 ]] && return
@ -792,11 +792,9 @@ _lp_fossil_branch_color()
fi
if [[ "$C2A" -gt 0 ]] ; then
if [[ "$ret" = "" ]] ; then
ret+="?$C2A"
else
ret+="/?$C2A"
fi
C2A="$LP_MARK_UNTRACKED"
else
C2A=""
fi
if [[ "$ret" != "" ]] ; then
@ -805,15 +803,18 @@ _lp_fossil_branch_color()
if [[ "$branch" = "no-tag" ]] ; then
branch="${LP_COLOR_COMMITS}$branch${NO_COL}"
# Warning, your branch has no tag name !
branch="${LP_COLOR_COMMITS}$branch${NO_COL}$ret${LP_COLOR_COMMITS}$C2A${NO_COL}"
else
if [[ "$C2E" -eq 0 && "$C2D" -eq 0 ]] ; then
branch="${LP_COLOR_UP}$branch${NO_COL}"
# All is up-to-date
branch="${LP_COLOR_UP}$branch$C2A${NO_COL}"
else
branch="${LP_COLOR_CHANGES}$branch${NO_COL}" # changes to commit
# There're some changes to commit
branch="${LP_COLOR_CHANGES}$branch${NO_COL}$ret${LP_COLOR_CHANGES}$C2A${NO_COL}"
fi
fi
echo -ne "$branch$ret${NO_COL}"
echo -ne "$branch"
fi
}

View File

@ -73,6 +73,10 @@ LP_ENABLE_SVN=1
# Recommended value is 1
LP_ENABLE_HG=1
# Do you want to use the fossil special features ?
# Recommended value is 1
LP_ENABLE_FOSSIL=1
# Show time of the last prompt display
# Recommended value is 0
LP_ENABLE_TIME=0