summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSiddhesh Poyarekar <siddhesh@gotplt.org>2020-11-18 08:14:37 +0530
committerSiddhesh Poyarekar <siddhesh@gotplt.org>2020-11-19 09:38:06 +0530
commit7d7d3c0a68e7ed05aef133b8bb9a770a7562891a (patch)
tree9d5f6c71b2a8e0d3f88548202f1cf48aa1bb1b0e
parentac91d2f35a566924e367adeb6e530a68b9ac4e16 (diff)
downloadgnulib-7d7d3c0a68e7ed05aef133b8bb9a770a7562891a.tar.gz
gnulib-7d7d3c0a68e7ed05aef133b8bb9a770a7562891a.tar.bz2
vcs-to-changelog: Expect spaces in file names
Reported by Thierry Bothorel <thierry.bothorel@zaclys.net> in <https://lists.gnu.org/archive/html/bug-gnulib/2020-11/msg00040.html>, * build-aux/vcstocl/vcs_git.py (exec_git_cmd): Do not transform tabs to spaces. (list_changes): Use tabs to identify file names.
-rw-r--r--ChangeLog9
-rw-r--r--build-aux/vcstocl/vcs_git.py26
2 files changed, 25 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog
index d50f4d1a26..52524da541 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2020-11-19 Siddhesh Poyarekar <siddhesh@gotplt.org>
+
+ vcs-to-changelog: Expect spaces in file names
+ Reported by Thierry Bothorel <thierry.bothorel@zaclys.net> in
+ <https://lists.gnu.org/archive/html/bug-gnulib/2020-11/msg00040.html>,
+ * build-aux/vcstocl/vcs_git.py (exec_git_cmd): Do not transform
+ tabs to spaces.
+ (list_changes): Use tabs to identify file names.
+
2020-11-17 Akim Demaille <akim@lrde.epita.fr>
bitset: strengthen tests
diff --git a/build-aux/vcstocl/vcs_git.py b/build-aux/vcstocl/vcs_git.py
index 23ede3b5a3..4c1f8ca5db 100644
--- a/build-aux/vcstocl/vcs_git.py
+++ b/build-aux/vcstocl/vcs_git.py
@@ -34,7 +34,7 @@ class GitRepo:
# Clean up the output by removing trailing spaces, newlines and dropping
# blank lines.
op = [decode(x[:-1]).strip() for x in proc.stdout]
- op = [re.sub(r'[\s\f]+', ' ', x) for x in op]
+ op = [re.sub(r'[ \f]+', ' ', x) for x in op]
op = [x for x in op if x]
return op
@@ -125,25 +125,31 @@ class GitRepo:
#
# For more details: https://git-scm.com/docs/diff-format
for f in op:
- data = f.split()
+ data = f.split('\t')
+ file1 = data[1]
+ if len(data) > 2:
+ file2 = data[2]
+
+ data = data[0].split()
+
if data[4] == 'A':
- print('\t* %s: New file.' % data[5])
+ print('\t* %s: New file.' % file1)
elif data[4] == 'D':
- print('\t* %s: Delete file.' % data[5])
+ print('\t* %s: Delete file.' % file1)
elif data[4] == 'T':
print('\t* %s: Changed file permission bits from %s to %s' % \
- (data[5], data[0], data[1]))
+ (file1, data[0], data[1]))
elif data[4][0] == 'M':
- print('\t* %s: Modified.' % data[5])
- analyze_diff(data[5],
+ print('\t* %s: Modified.' % file1)
+ analyze_diff(file1,
self.exec_git_cmd(['show', data[2]]),
self.exec_git_cmd(['show', data[3]]), frontends)
elif data[4][0] == 'R' or data[4][0] == 'C':
change = int(data[4][1:])
- print('\t* %s: Move to...' % data[5])
- print('\t* %s: ... here.' % data[6])
+ print('\t* %s: Move to...' % file1)
+ print('\t* %s: ... here.' % file2)
if change < 100:
- analyze_diff(data[6],
+ analyze_diff(file2,
self.exec_git_cmd(['show', data[2]]),
self.exec_git_cmd(['show', data[3]]), frontends)
# We should never encounter this, so ignore for now.

Return to:

Send suggestions and report system problems to the System administrator.