Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(956)

Issue 16211005: Allow --3way to be passed to `git apply` via `git cl patch`. (Closed)

Created:
7 years, 6 months ago by tapted
Modified:
7 years, 5 months ago
CC:
chromium-reviews, Dirk Pranke, cmp-cc_chromium.org, M-A Ruel, iannucci+depot_tools_chromium.org, chrome-apps-syd-reviews_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Visibility:
Public.

Description

Default to using --3way when using `git cl patch` with git >= 1.7.12 Git introduced a --3way argument to `apply` in version 1.7.12 [1]. This provides a much nicer way to apply issues from Rietveld. After this change, `git cl patch` will add --3way after checking the git version for support. [1] https://github.com/git/git/commit/f247b10aa0f75727f1b4bdd67b060720b8219b29 BUG=None TEST=Ran `git cl patch <issue>` with both clean and unclean patches, also checked behaviour of --reject is preserved. R=maruel@chromium.org

Patch Set 1 #

Patch Set 2 : fix upload #

Total comments: 1

Patch Set 3 : make 3way default #

Total comments: 2

Patch Set 4 : rebase #

Patch Set 5 : add a git version check ( >= 1.7.12 ) #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+12 lines, -1 line) Patch
M git_cl.py View 1 2 3 4 4 chunks +12 lines, -1 line 2 comments Download

Messages

Total messages: 11 (0 generated)
tapted
7 years, 6 months ago (2013-06-05 05:54:11 UTC) #1
M-A Ruel
https://codereview.chromium.org/16211005/diff/4001/git_cl.py File git_cl.py (right): https://codereview.chromium.org/16211005/diff/4001/git_cl.py#newcode1756 git_cl.py:1756: elif options.three_way: I'm fine with adding it as the ...
7 years, 6 months ago (2013-06-05 18:47:33 UTC) #2
tapted
Is this what you had in mind? This preserves the behaviour of --reject, but otherwise ...
7 years, 6 months ago (2013-06-06 01:07:05 UTC) #3
M-A Ruel
lgtm
7 years, 6 months ago (2013-06-06 20:03:39 UTC) #4
tapted
Committed patchset #3 manually as r204671 (presubmit successful).
7 years, 6 months ago (2013-06-07 00:12:53 UTC) #5
ncarter (slow)
https://codereview.chromium.org/16211005/diff/9001/git_cl.py File git_cl.py (right): https://codereview.chromium.org/16211005/diff/9001/git_cl.py#newcode1755 git_cl.py:1755: cmd.append('--3way') FYI: this option doesn't seem to exist in ...
7 years, 6 months ago (2013-06-07 19:42:00 UTC) #6
M-A Ruel
https://codereview.chromium.org/16211005/diff/9001/git_cl.py File git_cl.py (right): https://codereview.chromium.org/16211005/diff/9001/git_cl.py#newcode1755 git_cl.py:1755: cmd.append('--3way') On 2013/06/07 19:42:00, ncarter wrote: > FYI: this ...
7 years, 6 months ago (2013-06-07 19:44:45 UTC) #7
tapted
On 2013/06/07 19:44:45, Marc-Antoine Ruel wrote: > https://codereview.chromium.org/16211005/diff/9001/git_cl.py > File git_cl.py (right): > > https://codereview.chromium.org/16211005/diff/9001/git_cl.py#newcode1755 ...
7 years, 6 months ago (2013-06-07 23:43:19 UTC) #8
tapted
maruel: PTAL. I was inspired to give this another go. This adds a version check ...
7 years, 5 months ago (2013-07-09 01:46:10 UTC) #9
M-A Ruel
On 2013/07/09 01:46:10, tapted wrote: > maruel: PTAL. I was inspired to give this another ...
7 years, 5 months ago (2013-07-09 13:27:14 UTC) #10
tapted
7 years, 5 months ago (2013-07-10 01:11:52 UTC) #11
On 2013/07/09 13:27:14, Marc-Antoine Ruel wrote:
> On 2013/07/09 01:46:10, tapted wrote:
> > maruel: PTAL. I was inspired to give this another go. This adds a version
> check
> > using distutils.version.LooseVersion. Tested with a crusty 1.7.9 I had lying
> > around in cygwin.
> 
> Please create a new CL instead of reusing this one.

Created https://codereview.chromium.org/18966004 . I'll publish momentarily and
close this one.

https://codereview.chromium.org/16211005/diff/24001/git_cl.py
File git_cl.py (right):

https://codereview.chromium.org/16211005/diff/24001/git_cl.py#newcode11
git_cl.py:11: from distutils.version import LooseVersion
On 2013/07/09 13:27:15, Marc-Antoine Ruel wrote:
> I don't think this exists on Windows.

All my tests seem happy. I think this is just part of the python standard
library, since 1998 (aka forever). The file history is just whitepsace and
comment tweaks -
http://hg.python.org/cpython/log/b44749cee660/Lib/distutils/version.py

Tested with Python 2.6.2 in cmd.exe . I had to install unixutils and put it in
my path because `git cl patch` runs things through `sed`. There's even a
convenient conflict landed in git_cl.py the last 24 hours to see the 'old'
behaviour.

D:\src\depot_tools>python --version
Python 2.6.2

D:\src\depot_tools>where python
D:\src\depot_tools\python.bat
C:\python_26_amd64\files\python.exe

D:\src\depot_tools>python git_cl.py patch 16211005
Loaded authentication cookies from C:\Users\tapted/.codereview_upload_cookies
error: patch failed: git_cl.py:1757
error: git_cl.py: patch does not apply
Failed to apply the patch

/* rebase at 18966004 */

D:\src\depot_tools>python git_cl.py patch 18966004
Loaded authentication cookies from C:\Users\tapted/.codereview_upload_cookies
Committed patch locally.

D:\src\depot_tools>git cl patch 18966004
Loaded authentication cookies from C:\Users\tapted/.codereview_upload_cookies
error: patch failed: git_cl.py:8
Falling back to three-way merge...
Applied patch to 'git_cl.py' cleanly.
Command "git commit -m patch from issue 18966004" failed.
# On branch master
# Your branch is ahead of 'origin/master' by 1 commit.
#
nothing to commit, working directory clean

Powered by Google App Engine
This is Rietveld 408576698