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

Unified Diff: trychange.py

Issue 501166: Remove more logic out of trychange.py into scm.py. (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/trychange_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 35a57433fd16455da69fe5ee5f3f310aefa37ade..e29f054fd280de7938a8b4c44bafc186bbdfa728 100755
--- a/trychange.py
+++ b/trychange.py
@@ -85,7 +85,6 @@ class SVN(SCM):
def __init__(self, *args, **kwargs):
SCM.__init__(self, *args, **kwargs)
self.checkout_root = scm.SVN.GetCheckoutRoot(os.getcwd())
- self.options.files
if not self.options.diff:
# Generate the diff from the scm.
self.options.diff = self._GenerateDiff()
@@ -130,29 +129,13 @@ class GIT(SCM):
"""Gathers the options and diff for a git checkout."""
def __init__(self, *args, **kwargs):
SCM.__init__(self, *args, **kwargs)
- self.checkout_root = os.path.abspath(
- gclient_utils.CheckCall(['git', 'rev-parse', '--show-cdup']).strip())
+ self.checkout_root = scm.GIT.GetCheckoutRoot(os.getcwd())
if not self.options.diff:
- self.options.diff = self._GenerateDiff()
+ self.options.diff = scm.GIT.GenerateDiff(self.checkout_root)
if not self.options.name:
- self.options.name = self._GetPatchName()
+ self.options.name = scm.GIT.GetPatchName(self.checkout_root)
if not self.options.email:
- self.options.email = scm.GIT.GetEmail('.')
-
- def _GenerateDiff(self):
- """Get the diff we'll send to the try server. We ignore the files list."""
- return scm.GIT.GenerateDiff(self.checkout_root)
-
- def _GetPatchName(self):
- """Construct a name for this patch."""
- # TODO: perhaps include the hash of the current commit, to distinguish
- # patches?
- branch = gclient_utils.CheckCall(['git', 'symbolic-ref', 'HEAD']).strip()
- if not branch.startswith('refs/heads/'):
- # TODO(maruel): Find a better type.
- raise NoTryServerAccess("Couldn't figure out branch name")
- branch = branch[len('refs/heads/'):]
- return branch
+ self.options.email = scm.GIT.GetEmail(self.checkout_root)
def GetLocalRoot(self):
"""Return the path of the repository root."""
« no previous file with comments | « tests/trychange_unittest.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698