=== modified file 'acinclude/squid-util.m4'
--- acinclude/squid-util.m4	2010-07-09 11:45:58 +0000
+++ acinclude/squid-util.m4	2010-09-03 17:24:22 +0000
@@ -179,3 +179,29 @@
   AC_MSG_ERROR([$2])
 fi
 ])
+
+AC_DEFUN([SQUID_EMBED_BUILD_INFO],[
+  AC_ARG_ENABLE([build-info],
+    AS_HELP_STRING([--enable-build-info="build info string"],
+      [Add an additional string in the output of "string -v".
+       Default is not to add anything. If the string is not specified,
+       tries to determine nick and revision number of the current 
+       bazaar branch]))
+  if test "x${enable_build_info:=no}" != "xno"; then
+    if test "x$enable_build_info" != "xyes" ; then
+        squid_build_info="`echo ${enable_build_info}| sed 's/\"//g'`"
+    fi
+    if test "x$squid_build_info" = "x" -a -d "${srcdir}/.bzr" ; then
+      AC_PATH_PROG(BZR,bzr,$FALSE)
+      squid_bzr_branch_nick=`${BZR} nick 2>/dev/null`
+      if test $? -eq 0 -a "x$squid_bzr_branch_nick" != "x"; then
+          squid_bzr_branch_revno=`${BZR} revno 2>/dev/null | sed 's/\"//g'`
+      fi
+      if test $? -eq 0 -a "x$squid_bzr_branch_revno" != "x"; then
+          squid_build_info="Built branch: ${squid_bzr_branch_nick}-r${squid_bzr_branch_revno}"
+      fi
+    fi
+    AC_DEFINE_UNQUOTED([SQUID_BUILD_INFO],["$squid_build_info"],
+       [Squid extended build info field for "squid -v" output])
+  fi
+])

=== modified file 'configure.in'
--- configure.in	2010-08-24 10:35:03 +0000
+++ configure.in	2010-09-03 17:10:48 +0000
@@ -295,6 +295,9 @@
 SQUID_CXXFLAGS="$SQUID_CXXFLAGS $squid_cv_cc_arg_pipe"
 SQUID_CFLAGS="$SQUID_CFLAGS $squid_cv_cc_arg_pipe"
 
+# possibly include some build info tag into squid -v
+SQUID_EMBED_BUILD_INFO
+
 AC_ARG_ENABLE(optimizations,
   AS_HELP_STRING([--disable-optimizations],
                  [Do not compile Squid with compiler optimizations enabled.

=== modified file 'src/main.cc'
--- src/main.cc	2010-08-23 23:15:26 +0000
+++ src/main.cc	2010-09-03 16:11:58 +0000
@@ -113,6 +113,10 @@
 
 #endif
 
+#ifndef SQUID_BUILD_INFO
+#define SQUID_BUILD_INFO ""
+#endif
+
 /** for error reporting from xmalloc and friends */
 SQUIDCEXTERN void (*failure_notify) (const char *);
 
@@ -531,7 +535,7 @@
         case 'v':
             /** \par v
              * Display squid version and build information. Then exit. */
-            printf("Squid Cache: Version %s\nconfigure options: %s\n", version_string, SQUID_CONFIGURE_OPTIONS);
+            printf("Squid Cache: Version %s\n%s\nconfigure options: %s\n", version_string, SQUID_BUILD_INFO, SQUID_CONFIGURE_OPTIONS);
 
 #if USE_WIN32_SERVICE
 

=== modified file 'test-suite/buildtests/layer-00-default.opts'
--- test-suite/buildtests/layer-00-default.opts	2009-10-04 03:33:15 +0000
+++ test-suite/buildtests/layer-00-default.opts	2010-09-03 16:18:37 +0000
@@ -6,7 +6,7 @@
 # Default configuration options.
 #  - Nothing special configured. Just whatever is found by "./configure"
 #
-OPTS=""
+OPTS="--enable-build-info"
 
 # Fix the distclean testing.
 export DISTCHECK_CONFIGURE_FLAGS="${OPTS}"

=== modified file 'test-suite/buildtests/layer-01-minimal.opts'
--- test-suite/buildtests/layer-01-minimal.opts	2010-04-20 15:37:43 +0000
+++ test-suite/buildtests/layer-01-minimal.opts	2010-09-03 16:18:52 +0000
@@ -27,6 +27,7 @@
 #
 #
 OPTS=" \
+    --enable-build-info \
 	--disable-loadable-modules \
 	--disable-gnuregex \
 	--disable-optimizations \

=== modified file 'test-suite/buildtests/layer-02-maximus.opts'
--- test-suite/buildtests/layer-02-maximus.opts	2010-07-21 02:40:18 +0000
+++ test-suite/buildtests/layer-02-maximus.opts	2010-09-03 16:19:05 +0000
@@ -41,6 +41,7 @@
 #
 #
 OPTS=" \
+    --enable-build-info \
 	--enable-loadable-modules \
 	--enable-gnuregex \
 	--enable-optimizations \

=== modified file 'test-suite/buildtests/layer-05-nodeps-esi.opts'
--- test-suite/buildtests/layer-05-nodeps-esi.opts	2009-11-04 05:07:56 +0000
+++ test-suite/buildtests/layer-05-nodeps-esi.opts	2010-09-03 16:19:13 +0000
@@ -10,7 +10,7 @@
 # NP: there must be no overlap in code for plugging the libraries in/out.
 #     this means we can test the absence of all in one run and save time.
 #
-OPTS="--enable-esi --without-expat --without-libxml2"
+OPTS="--enable-esi --without-expat --without-libxml2 --enable-build-info"
 
 # Fix the distclean testing.
 export DISTCHECK_CONFIGURE_FLAGS="${OPTS}"