This is an automated email from the ASF dual-hosted git repository.
sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git
The following commit(s) were added to refs/heads/master by this push:
new 52e3d68 update now supports diff option
52e3d68 is described below
commit 52e3d689cb6cf08ffae993c94bd2258bb44b8a55
Author: Sebb <[email protected]>
AuthorDate: Wed Jul 8 14:09:50 2020 +0100
update now supports diff option
---
lib/whimsy/asf/svn.rb | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/lib/whimsy/asf/svn.rb b/lib/whimsy/asf/svn.rb
index 6c17640..13e2211 100644
--- a/lib/whimsy/asf/svn.rb
+++ b/lib/whimsy/asf/svn.rb
@@ -559,6 +559,7 @@ module ASF
# _ - wunderbar context
# options - hash of:
# :dryrun - show command (excluding credentials), without executing it
+ # :diff - show diff before committing
def self.update(path, msg, env, _, options={})
if File.directory? path
dir = path
@@ -619,12 +620,14 @@ module ASF
# show what would have been committed
rc = self.svn_('diff', tmpfile || tmpdir, _)
return rc # No point checking for pending changes
- else
- # commit the changes
- rc = self.svn_('commit', tmpfile || tmpdir, _,
- {msg: msg.untaint, env: env})
end
+ self.svn_('diff', tmpfile || tmpdir, _) if options[:diff]
+
+ # commit the changes
+ rc = self.svn_('commit', tmpfile || tmpdir, _,
+ {msg: msg.untaint, env: env})
+
# fail if there are pending changes
out, err = self.svn('status', tmpfile || tmpdir) # Need to use svn
rather than svn_ here
unless rc == 0 && out && out.empty?