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

Unified Diff: gcl.py

Issue 501143: Remove gclient-specific hacks from trychange into gcl. (Closed)
Patch Set: Small unit test fix Created 11 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | gclient_utils.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gcl.py
diff --git a/gcl.py b/gcl.py
index 4258f400eb05b8b439d62b381f6c0ffe816af618..61efad5663f71b93ffaa752a2bae42d07ab7786f 100755
--- a/gcl.py
+++ b/gcl.py
@@ -24,7 +24,7 @@ import breakpad
from scm import SVN
import gclient_utils
-__version__ = '1.1.2'
+__version__ = '1.1.3'
CODEREVIEW_SETTINGS = {
@@ -858,8 +858,35 @@ def TryChange(change_info, args, swallow_exception):
return
ErrorExit("You need to install trychange.py to use the try server.")
+ def PathDifference(root, subpath):
+ """Returns the difference subpath minus root."""
+ root = os.path.realpath(root)
+ subpath = os.path.realpath(subpath)
+ if not subpath.startswith(root):
+ return None
+ # If the root does not have a trailing \ or /, we add it so the returned
+ # path starts immediately after the seperator regardless of whether it is
+ # provided.
+ root = os.path.join(root, '')
+ return subpath[len(root):]
+
+ # Try to find the gclient root.
+ def FindGclientRootDir(from_dir):
+ path = os.path.realpath(from_dir)
+ while not os.path.exists(os.path.join(path, '.gclient')):
+ next = os.path.split(path)
+ if not next[1]:
+ return None
+ path = next[0]
+ return path
+
+ trychange_args = []
+ gclient_root = FindGclientRootDir(GetRepositoryRoot())
+ if gclient_root:
+ trychange_args.extend(['--root', PathDifference(gclient_root,
+ GetRepositoryRoot())])
if change_info:
- trychange_args = ['--name', change_info.name]
+ trychange_args.extend(['--name', change_info.name])
if change_info.issue:
trychange_args.extend(["--issue", str(change_info.issue)])
if change_info.patchset:
@@ -870,7 +897,8 @@ def TryChange(change_info, args, swallow_exception):
swallow_exception=swallow_exception,
prog='gcl try')
else:
- trychange.TryChange(args,
+ trychange_args.extend(args)
+ trychange.TryChange(trychange_args,
file_list=None,
swallow_exception=swallow_exception,
prog='gcl try')
« no previous file with comments | « no previous file | gclient_utils.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698