Hello,

On 11/06/2014 07:47 PM, Karl Berry wrote:
My feedback is that instead of being a separate script that is mostly
the same, it seems like it would be better as an option.

Attached is an updated patch, this time adding "-G/--git" option to the 
existing script 'build-aux/gnu-web-doc-update' .

Even better,
it seems like it would be easy enough to intuit whether to use git or
cvs, by looking for the presence of a CVS directory.

Good idea.
I'll send an update once the Web-Git repositories configuration is stable.


Thanks!
 - Assaf

>From 2899a877f801288cfb48f1a4fe01f9d76e23c2e9 Mon Sep 17 00:00:00 2001
From: "A. Gordon" <assafgor...@gmail.com>
Date: Thu, 6 Nov 2014 16:00:50 -0500
Subject: [PATCH] maint: add -G/--git option to gnu-web-doc-update

* build-aux/gnu-web-doc-update - added option -G/--git to push updated
manual/documentation to the Web Git repositories.

--EXPERIMENTAL--
See here for details:
http://lists.gnu.org/archive/html/savannah-hackers-public/2014-11/msg00001.html
Pushed commits will appear on:
   http://gnu.housegordon.org/software/<PROJECT>/manual/
---
 build-aux/gnu-web-doc-update | 47 ++++++++++++++++++++++++++++----------------
 1 file changed, 30 insertions(+), 17 deletions(-)

diff --git a/build-aux/gnu-web-doc-update b/build-aux/gnu-web-doc-update
index 7af2f18..72ed6db 100755
--- a/build-aux/gnu-web-doc-update
+++ b/build-aux/gnu-web-doc-update
@@ -39,6 +39,7 @@ assumes all documentation is in the doc/ sub-directory.
 
 Options:
   -C, --builddir=DIR  location of (configured) Makefile (default: .)
+  -G, --git           push to GIT repository instead of CVS
   -n, --dry-run       don't actually commit anything
   --help              print this help, then exit
   --version           print version number, then exit
@@ -107,6 +108,7 @@ find_tool XARGS gxargs xargs
 
 builddir=.
 dryrun=
+repotype=cvs
 while test $# != 0
 do
   # Handle --option=value by splitting apart and putting back on argv.
@@ -122,6 +124,7 @@ do
   case $1 in
     --help|--version) ${1#--};;
     -C|--builddir) shift; builddir=$1; shift ;;
+    -G|--git) repotype=git; shift;;
     -n|--dry-run) dryrun=echo; shift;;
     --*) die "unrecognized option: $1";;
     *) break;;
@@ -167,23 +170,33 @@ cd "$srcdir"
 set +e
 
 tmp=$(mktemp -d web-doc-update.XXXXXX) || exit 1
-( cd $tmp \
-    && $CVS -d $u...@cvs.sv.gnu.org:/webcvs/$pkg co $pkg )
-$RSYNC -avP "$builddir"/doc/manual/ $tmp/$pkg/manual
-
-(
-  cd $tmp/$pkg/manual
-
-  # Add all the files.  This is simpler than trying to add only the
-  # new ones because of new directories: it would require iterating on
-  # adding the outer directories, and then their contents.
-  #
-  # find guarantees that we add outer directories first.
-  find . -name CVS -prune -o -print             \
-    | $XARGS --no-run-if-empty -- $dryrun $CVS add -ko
-
-  $dryrun $CVS ci -m $version
-)
+if test "x$repotype" = "xgit" ; then
+  $GIT clone --quiet $u...@git.sv.gnu.org:/srv/git/web/$pkg $tmp/$pkg || exit 1
+  $RSYNC -avP "$builddir"/doc/manual/ $tmp/$pkg/$pkg/manual || exit 1
+  (
+    cd $tmp/$pkg
+    $dryrun $GIT commit --quiet --all -m "Updated Manual for $version" \
+      && $dryrun $GIT push
+  ) || exit 1
+else
+  ( cd $tmp \
+      && $CVS -d $u...@cvs.sv.gnu.org:/webcvs/$pkg co $pkg )
+  $RSYNC -avP "$builddir"/doc/manual/ $tmp/$pkg/manual
+
+  (
+    cd $tmp/$pkg/manual
+
+    # Add all the files.  This is simpler than trying to add only the
+    # new ones because of new directories: it would require iterating on
+    # adding the outer directories, and then their contents.
+    #
+    # find guarantees that we add outer directories first.
+    find . -name CVS -prune -o -print             \
+      | $XARGS --no-run-if-empty -- $dryrun $CVS add -ko
+
+    $dryrun $CVS ci -m $version
+  )
+fi
 
 # Local variables:
 # eval: (add-hook 'write-file-hooks 'time-stamp)
-- 
1.9.1

Reply via email to