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

Unified Diff: gclient_scm.py

Issue 1742017: Add --reset-to-deps and improve comments (Closed)
Patch Set: fix tests Created 10 years, 8 months 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 | tests/gclient_scm_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gclient_scm.py
diff --git a/gclient_scm.py b/gclient_scm.py
index 40dccae0a0f80dcece07d01c907b56aa92503f11..e51a0eecb254bb47d937bc64347db6519350b340 100644
--- a/gclient_scm.py
+++ b/gclient_scm.py
@@ -403,9 +403,16 @@ class GitWrapper(SCMWrapper):
print("\n_____ %s is missing, synching instead" % self.relpath)
# Don't reuse the args.
return self.update(options, [], file_list)
- merge_base = self._Run(['merge-base', 'HEAD', 'origin'])
- files = self._Run(['diff', merge_base, '--name-only']).split()
- self._Run(['reset', '--hard', merge_base], redirect_stdout=False)
+
+ default_rev = "refs/heads/master"
+ url, deps_revision = gclient_utils.SplitUrlRevision(self.url)
+ if not deps_revision:
+ deps_revision = default_rev
+ if deps_revision.startswith('refs/heads/'):
+ deps_revision = deps_revision.replace('refs/heads/', 'origin/')
+
+ files = self._Run(['diff', deps_revision, '--name-only']).split()
+ self._Run(['reset', '--hard', deps_revision], redirect_stdout=False)
file_list.extend([os.path.join(self.checkout_path, f) for f in files])
def revinfo(self, options, args, file_list):
« no previous file with comments | « no previous file | tests/gclient_scm_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698