From: Akim Demaille <akim@lrde.epita.fr>
Date: Fri, 14 Dec 2012 11:58:35 +0000 (+0100)
Subject: gnu-web-doc-update: add all the new files, even in new directories
X-Git-Tag: v0.1~321
X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=d9963cfec3a40a2255d8ebb39834700a3fce6f5a;p=gnulib.git

gnu-web-doc-update: add all the new files, even in new directories

See http://lists.gnu.org/archive/html/bug-gnulib/2012-12/msg00057.html

* build-aux/gnu-web-doc-update (--dry-run, $dryrun): New.
Use it.
(main): Don't use cvsutils to get the list of unknown files,
just add all the existing files and directories.
---

diff --git a/ChangeLog b/ChangeLog
index fc36ecddf7..5fa567df39 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2012-12-16  Akim Demaille  <akim@lrde.epita.fr>
+
+	gnu-web-doc-update: add all the new files, even in new directories
+	See http://lists.gnu.org/archive/html/bug-gnulib/2012-12/msg00057.html
+	* build-aux/gnu-web-doc-update (--dry-run, $dryrun): New.
+	Use it.
+	(main): Don't use cvsutils to get the list of unknown files,
+	just add all the existing files and directories.
+
 2012-12-16  Akim Demaille  <akim@lrde.epita.fr>
 
 	gnu-web-doc-update: improve --help
diff --git a/build-aux/gnu-web-doc-update b/build-aux/gnu-web-doc-update
index e09db86630..dcf47f3e0c 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: .)
+  -n, --dry-run       don't actually commit anything
   --help              print this help, then exit
   --version           print version number, then exit
 
@@ -100,12 +101,12 @@ find_tool ()
 # Requirements: everything required to bootstrap your package, plus
 # these.
 find_tool CVS cvs
-find_tool CVSU cvsu
 find_tool GIT git
 find_tool RSYNC rsync
 find_tool XARGS gxargs xargs
 
 builddir=.
+dryrun=
 while test $# != 0
 do
   # Handle --option=value by splitting apart and putting back on argv.
@@ -121,6 +122,7 @@ do
   case $1 in
     --help|--version) ${1#--};;
     -C|--builddir) shift; builddir=$1; shift ;;
+    -n|--dry-run) dryrun=echo; shift;;
     --*) die "unrecognized option: $1";;
     *) break;;
   esac
@@ -139,7 +141,7 @@ current_branch=$($GIT branch | sed -ne '/^\* /{s///;p;q;}')
 cleanup()
 {
   __st=$?
-  rm -rf "$tmp"
+  $dryrun rm -rf "$tmp"
   $GIT checkout "$current_branch"
   $GIT submodule update --recursive
   $GIT branch -d $tmp_branch
@@ -172,12 +174,15 @@ $RSYNC -avP "$builddir"/doc/manual/ $tmp/$pkg/manual
 (
   cd $tmp/$pkg/manual
 
-  # Add any new files:
-  $CVSU --types='?'                             \
-    | sed s/..//                                \
-    | $XARGS --no-run-if-empty -- $CVS add -ko
+  # 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
 
-  $CVS ci -m $version
+  $dryrun $CVS ci -m $version
 )
 
 # Local variables: