2022-08-06 Bruno Haible <bruno@clisp.org>
+ gnulib-tool: In the VC files messages, omit the destination directory.
+ This makes these messages consistent with the other "Copying ..." and
+ "Creating ..." messages.
+ * gnulib-tool (func_import): Omit $destdir/ from the "Updating"/
+ "Creating" messages regarding .gitignore files.
+ * pygnulib/GLImport.py (GLImport._update_ignorelist_): Likewise.
+
gnulib-tool.py: Fix output in --dry-run mode.
* pygnulib/GLImport.py (GLImport._update_ignorelist_): In dry-run mode,
say "Update", not "Updating".
)
if test -s "$tmp"/ignore-added || test -s "$tmp"/ignore-removed; then
if $doit; then
- echo "Updating $destdir/$dir$ignore (backup in $destdir/$dir${ignore}~)"
+ echo "Updating $dir$ignore (backup in $dir${ignore}~)"
mv -f "$destdir/$dir$ignore" "$destdir/$dir$ignore"~
{ sed -e 's,/,\\/,g' -e 's,^,/^,' -e 's,$,\$/d,' < "$tmp"/ignore-removed
if test -n "$anchor"; then sed -e 's,/,\\/,g' -e "s,^,/^${doubly_escaped_anchor}," -e 's,$,$/d,' < "$tmp"/ignore-removed; fi
} | sed -f "$tmp"/sed-ignore-removed \
> "$destdir/$dir$ignore"
else
- echo "Update $destdir/$dir$ignore (backup in $destdir/$dir${ignore}~)"
+ echo "Update $dir$ignore (backup in $dir${ignore}~)"
fi
fi
fi
else
if test -n "$dir_added"; then
if $doit; then
- echo "Creating $destdir/$dir$ignore"
+ echo "Creating $dir$ignore"
{
if test "$ignore" = .cvsignore; then
echo ".deps"
echo "$dir_added" | sed -e '/^$/d' -e "s|^|$anchor|" | LC_ALL=C sort -u
} > "$destdir/$dir$ignore"
else
- echo "Create $destdir/$dir$ignore"
+ echo "Create $dir$ignore"
fi
fi
fi
anchor = '/'
else:
anchor = ''
- srcpath = joinpath(destdir, directory, ignore)
+ srcpath = joinpath(directory, ignore)
backupname = '%s~' % srcpath
- if isfile(srcpath):
+ if isfile(joinpath(destdir, srcpath)):
if dirs_added or dirs_removed:
- with codecs.open(srcpath, 'rb', 'UTF-8') as file:
+ with codecs.open(joinpath(destdir, srcpath), 'rb', 'UTF-8') as file:
srcdata = file.read()
dirs_ignore = sorted(set(srcdata.split('\n')))
dirs_ignore = [ line
if srcdata != destdata:
if not self.config['dryrun']:
print('Updating %s (backup in %s)' % (srcpath, backupname))
- copyfile2(srcpath, backupname)
+ copyfile2(joinpath(destdir, srcpath), joinpath(destdir, backupname))
result = ''
- with codecs.open(srcpath, 'ab', 'UTF-8') as file:
+ with codecs.open(joinpath(destdir, srcpath), 'ab', 'UTF-8') as file:
file.write(destdata)
else: # if self.config['dryrun']
print('Update %s (backup in %s)' % (srcpath, backupname))
- else: # if not isfile(srcpath)
+ else: # if not isfile(joinpath(destdir, srcpath))
if dirs_added:
if not self.config['dryrun']:
print('Creating %s' % srcpath)
for d in dirs_added ]
if ignore == '.cvsignore':
dirs_added = ['.deps', '.dirstamp'] + dirs_added
- with codecs.open(srcpath, 'wb', 'UTF-8') as file:
+ with codecs.open(joinpath(destdir, srcpath), 'wb', 'UTF-8') as file:
file.write('\n'.join(dirs_added))
file.write('\n')
else: # if self.config['dryrun']