From 97729276414fca15d305e1ab62ff346eb13dcd4e Mon Sep 17 00:00:00 2001 From: Guillem Jover Date: Thu, 4 Apr 2019 01:28:17 +0200 Subject: smart-change: Add new --modified and --commit options This should help work off the VCS. The --modified option helps with the following workflow: 1) Modify english version; commit. 2) Modify translations; use smart_change with -m; commit. The --commit option helps with the following workflow: 1) Modify english version; commit. 2) Modify translations; commit. 3) Use smart_change with -c from 2); commit. --- Perl/Local/VCS_git.pm | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'Perl') diff --git a/Perl/Local/VCS_git.pm b/Perl/Local/VCS_git.pm index 9bbb17988f8..7f67d9f17e4 100644 --- a/Perl/Local/VCS_git.pm +++ b/Perl/Local/VCS_git.pm @@ -1268,6 +1268,38 @@ sub next_revision return $ret; } +=item @files = get_modified_files_from_worktree() + +Returns a list of modified files in the current worktree. + +=cut + +sub get_modified_files_from_worktree +{ + my $self = shift; + + my (@files) = qx(git ls-files -m); + chomp @files; + + return @files; +} + +=item @files = get_modified_files_from_revision($revid) + +Returns a list of modified files in $revid. + +=cut + +sub get_modified_files_from_revision +{ + my ($self, $rev) = @_; + + my (@files) = qx(git diff-tree --no-commit-id --name-only --diff-filter=M -r $rev); + chomp @files; + + return @files; +} + =item get_topdir Return the top dir of the webwml repository -- cgit v1.2.3