public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: "Américo Wang" <xiyou.wangcong@gmail.com>
To: linux-btrfs@vger.kernel.org
Cc: Chris Mason <chris.mason@oracle.com>
Subject: [Patch] version.sh: clean up the code
Date: Mon, 19 Jan 2009 21:51:05 +0800	[thread overview]
Message-ID: <20090119135105.GB7863@hack.private> (raw)


- In bash, integer comparation should use '-eq', not '=='.
- Remove code for Mercurial, since btrfs now uses git.

Signed-off-by: WANG Cong <wangcong@zeuux.org>

---
diff --git a/version.sh b/version.sh
index 92c3953..e69f8f8 100644
--- a/version.sh
+++ b/version.sh
@@ -9,7 +9,7 @@
 v="Btrfs v0.17"
 
 which git &> /dev/null
-if [ $? == 0 -a -d .git ]; then
+if [ $? -eq 0 -a -d .git ]; then
     if head=`git rev-parse --verify HEAD 2>/dev/null`; then
         if tag=`git describe --tags 2>/dev/null`; then
             v="$tag"
@@ -23,26 +23,6 @@ if [ $? == 0 -a -d .git ]; then
         fi
     fi
 fi
-
-which hg &> /dev/null
-if [ $? == 0 -a -d .hg ]; then
-	last=$(hg tags | grep -m1 -o '^v[0-9.]\+')
-	 
-	# now check if the repo has commits since then...
-	if [[ $(hg id -t) == $last || \
-	    $(hg di -r "$last:." | awk '/^diff/{print $NF}' | sort -u) == .hgtags ]]
-	then
-	    # check if it's dirty
-	    if [[ $(hg id | cut -d' ' -f1) == *+ ]]; then
-		v=$last+
-	    else
-		v=$last
-	    fi
-	else
-	    # includes dirty flag
-	    v=$last+$(hg id -i)
-	fi
-fi
  
 echo "#ifndef __BUILD_VERSION" > .build-version.h
 echo "#define __BUILD_VERSION" >> .build-version.h
@@ -51,7 +31,7 @@ echo "#endif" >> .build-version.h
 
 diff -q version.h .build-version.h >& /dev/null
 
-if [ $? == 0 ]; then
+if [ $? -eq 0 ]; then
     rm .build-version.h
     exit 0
 fi



             reply	other threads:[~2009-01-19 13:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-19 13:51 Américo Wang [this message]
2009-01-21 15:01 ` [Patch] version.sh: clean up the code Chris Mason
2009-01-22 16:10   ` Américo Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090119135105.GB7863@hack.private \
    --to=xiyou.wangcong@gmail.com \
    --cc=chris.mason@oracle.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox