diff options
author | Mike Crowe <mcrowe@zipitwireless.com> | 2011-01-12 00:53:52 -0500 |
---|---|---|
committer | Michal Marek <mmarek@suse.cz> | 2011-01-14 18:40:44 -0500 |
commit | 38b3439d84f4a310bd29e3dbc21dffe9119ef157 (patch) | |
tree | 56c30b9908deba0a0f7494fb9da9589202ec04d7 /scripts | |
parent | 0719e1d23aab3b445c823404fd1b8b027757bb0a (diff) |
setlocalversion: update mercurial tag parsing
The tag output of hg doesn't quite match what setlocalversion currently
expects, so update it to handle the latest format.
Signed-off-by: Mike Crowe <mcrowe@zipitwireless.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Michal Marek <mmarek@suse.cz>
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/setlocalversion | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/scripts/setlocalversion b/scripts/setlocalversion index ef8729f48586..4d403844e137 100755 --- a/scripts/setlocalversion +++ b/scripts/setlocalversion | |||
@@ -86,12 +86,16 @@ scm_version() | |||
86 | 86 | ||
87 | # Check for mercurial and a mercurial repo. | 87 | # Check for mercurial and a mercurial repo. |
88 | if test -d .hg && hgid=`hg id 2>/dev/null`; then | 88 | if test -d .hg && hgid=`hg id 2>/dev/null`; then |
89 | tag=`printf '%s' "$hgid" | cut -s -d' ' -f2` | 89 | # Do we have an tagged version? If so, latesttagdistance == 1 |
90 | 90 | if [ "`hg log -r . --template '{latesttagdistance}'`" == "1" ]; then | |
91 | # Do we have an untagged version? | 91 | id=`hg log -r . --template '{latesttag}'` |
92 | if [ -z "$tag" -o "$tag" = tip ]; then | ||
93 | id=`printf '%s' "$hgid" | sed 's/[+ ].*//'` | ||
94 | printf '%s%s' -hg "$id" | 92 | printf '%s%s' -hg "$id" |
93 | else | ||
94 | tag=`printf '%s' "$hgid" | cut -d' ' -f2` | ||
95 | if [ -z "$tag" -o "$tag" = tip ]; then | ||
96 | id=`printf '%s' "$hgid" | sed 's/[+ ].*//'` | ||
97 | printf '%s%s' -hg "$id" | ||
98 | fi | ||
95 | fi | 99 | fi |
96 | 100 | ||
97 | # Are there uncommitted changes? | 101 | # Are there uncommitted changes? |