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

Unified Diff: trychange.py

Issue 502085: Factor out gcl.GetRepositoryRoot() into scm.SVN.GetCheckoutRoot() (Closed)
Patch Set: 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 | « tests/scm_unittest.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: trychange.py
diff --git a/trychange.py b/trychange.py
index 39af71ed0e941b4f1eb36263b6c2b8df6290add5..691c67de285546ed79077886cc6d2670cd1d76fb 100755
--- a/trychange.py
+++ b/trychange.py
@@ -138,10 +138,7 @@ class SVN(SCM):
used.
"""
previous_cwd = os.getcwd()
- if root is None:
- os.chdir(gcl.GetRepositoryRoot())
- else:
- os.chdir(root)
+ os.chdir(root or scm.SVN.GetCheckoutRoot(previous_cwd))
# Directories will return None so filter them out.
diff = filter(None, [scm.SVN.DiffItem(f) for f in files])
@@ -157,19 +154,23 @@ class SVN(SCM):
return self.change_info.GetLocalRoot()
def ProcessOptions(self):
+ checkout_root = None
if not self.options.diff:
# Generate the diff with svn and write it to the submit queue path. The
# files are relative to the repository root, but we need patches relative
# to one level up from there (i.e., 'src'), so adjust both the file
# paths and the root of the diff.
+ # TODO(maruel): Remove this hack.
source_root = GetSourceRoot()
- prefix = PathDifference(source_root, gcl.GetRepositoryRoot())
+ checkout_root = scm.SVN.GetCheckoutRoot(os.getcwd())
+ prefix = PathDifference(source_root, checkout_root)
adjusted_paths = [os.path.join(prefix, x) for x in self.options.files]
self.options.diff = self.GenerateDiff(adjusted_paths, root=source_root)
self.change_info = gcl.LoadChangelistInfoForMultiple(self.options.name,
gcl.GetRepositoryRoot(), True, True)
if not self.options.email:
- self.options.email = scm.SVN.GetEmail(gcl.GetRepositoryRoot())
+ checkout_root = checkout_root or scm.SVN.GetCheckoutRoot(os.getcwd())
+ self.options.email = scm.SVN.GetEmail(checkout_root)
class GIT(SCM):
« no previous file with comments | « tests/scm_unittest.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698