From: Siddhesh Poyarekar Date: Wed, 18 Nov 2020 02:44:37 +0000 (+0530) Subject: vcs-to-changelog: Expect spaces in file names X-Git-Tag: v1.0~3494 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=7d7d3c0a68e7ed05aef133b8bb9a770a7562891a;p=gnulib.git vcs-to-changelog: Expect spaces in file names Reported by Thierry Bothorel in , * build-aux/vcstocl/vcs_git.py (exec_git_cmd): Do not transform tabs to spaces. (list_changes): Use tabs to identify file names. --- diff --git a/ChangeLog b/ChangeLog index d50f4d1a26..52524da541 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2020-11-19 Siddhesh Poyarekar + + vcs-to-changelog: Expect spaces in file names + Reported by Thierry Bothorel in + , + * 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 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.