You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by mp...@apache.org on 2017/02/03 19:46:44 UTC

mesos git commit: Added `--3way` option to `support/apply-reviews.py`.

Repository: mesos
Updated Branches:
  refs/heads/master 2e49953b1 -> eec6f32ad


Added `--3way` option to `support/apply-reviews.py`.

This can help on some patches which includes conflicts that can be
resolved by 3-way merge.

Review: https://reviews.apache.org/r/55732/


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/eec6f32a
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/eec6f32a
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/eec6f32a

Branch: refs/heads/master
Commit: eec6f32ad5f86527c211b775baade55b1e5bcf8e
Parents: 2e49953
Author: Zhitao Li <zh...@gmail.com>
Authored: Fri Feb 3 11:46:07 2017 -0800
Committer: Michael Park <mp...@apache.org>
Committed: Fri Feb 3 11:46:07 2017 -0800

----------------------------------------------------------------------
 support/apply-reviews.py | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/eec6f32a/support/apply-reviews.py
----------------------------------------------------------------------
diff --git a/support/apply-reviews.py b/support/apply-reviews.py
index cdfdd58..b495675 100755
--- a/support/apply-reviews.py
+++ b/support/apply-reviews.py
@@ -118,8 +118,8 @@ def apply_review():
   # Make sure we don't leave the patch behind in case of failure.
   # We store the patch ID in a local variable to ensure the lambda
   # captures the current patch ID.
-  patch = patch_id()
-  atexit.register(lambda: os.remove('%s.patch' % patch))
+  patch_file = '%s.patch' % patch_id()
+  atexit.register(lambda: os.path.exists(patch_file) and os.remove(patch_file))
 
   fetch_patch()
   apply_patch()
@@ -185,6 +185,9 @@ def apply_patch():
   cmd = 'git apply --index {review_id}.patch'\
         .format(review_id=patch_id())
 
+  if options['3way']:
+    cmd += ' --3way'
+
   if platform.system() == 'Windows':
     # NOTE: Depending on the Git settings, there may or may not be
     # carriage returns in files and in the downloaded patch.
@@ -210,7 +213,7 @@ def commit_patch():
 
   # NOTE: Windows does not support multi-line commit messages via the shell.
   message_file = '%s.message' % patch_id()
-  atexit.register(lambda: os.remove(message_file))
+  atexit.register(lambda: os.path.exists(message_file) and os.remove(message_file))
 
   with open(message_file, 'w') as message:
     message.write(data['message'])
@@ -319,6 +322,11 @@ def parse_options():
                       action='store_true',
                       help='Recursively apply parent review chain.')
 
+  parser.add_argument('-3', '--3way',
+                      dest='three_way',
+                      action='store_true',
+                      help='Use 3 way merge in git apply.')
+
   # Add -g and -r and make them mutually exclusive.
   group = parser.add_mutually_exclusive_group(required=True)
   group.add_argument('-g', '--github',
@@ -335,6 +343,7 @@ def parse_options():
   options['no_amend'] = args.no_amend
   options['github'] = args.github
   options['chain'] = args.chain
+  options['3way'] = args.three_way
 
 
 def reviewboard():