Chromium Code Reviews| Index: tests/gclient_scm_test.py | 
| diff --git a/tests/gclient_scm_test.py b/tests/gclient_scm_test.py | 
| index 5607f85dda123b20633d3daaf9003d91e43fda66..c6038779556f877293099a21ea0c21a929160728 100755 | 
| --- a/tests/gclient_scm_test.py | 
| +++ b/tests/gclient_scm_test.py | 
| @@ -752,6 +752,20 @@ from :3 | 
| M 100644 :4 a | 
| M 100644 :5 b | 
| +blob | 
| +mark :7 | 
| +data 5 | 
| +Mooh | 
| + | 
| +commit refs/heads/feature | 
| +mark :8 | 
| +author Bob <bob@example.com> 1390311986 -0000 | 
| +committer Bob <bob@example.com> 1390311986 -0000 | 
| +data 6 | 
| +Add C | 
| +from :3 | 
| +M 100644 :7 c | 
| + | 
| reset refs/heads/master | 
| from :3 | 
| """ | 
| @@ -967,6 +981,50 @@ class ManagedGitWrapperTestCase(BaseGitWrapperTestCase): | 
| 'a7142dc9f0009350b96a11f372b6ea658592aa95') | 
| sys.stdout.close() | 
| + def testUpdateMerge(self): | 
| + if not self.enabled: | 
| + return | 
| + options = self.Options() | 
| + options.merge = True | 
| + scm = gclient_scm.CreateSCM(url=self.url, root_dir=self.root_dir, | 
| + relpath=self.relpath) | 
| + scm._Run(['checkout', '-q', 'feature'], options) | 
| + rev = scm.revinfo(options, (), None) | 
| + file_list = [] | 
| + scm.update(options, (), file_list) | 
| + self.assertEquals(file_list, [join(self.base_path, x) | 
| + for x in ['a', 'b', 'c']]) | 
| + # The actual commit that is created is unstable, so we verify its tree and | 
| + # parents instead. | 
| + self.assertEquals(scm._Capture(['show', '--format=%T', '-s']), | 
| + 'd2e35c10ac24d6c621e14a1fcadceb533155627d') | 
| 
 
iannucci
2014/01/21 21:40:47
Isn't this the same as `git rev-parse HEAD:`?
 
Bernhard Bauer
2014/01/21 23:03:54
No, this is the tree (i.e. without the commit meta
 
iannucci
2014/01/21 23:23:29
Right, hence the trailing colon :)
HEAD:path refe
 
Bernhard Bauer
2014/01/22 15:59:50
Ooh, that's neat! Done.
 
 | 
| + self.assertEquals(scm._Capture(['rev-parse', 'HEAD^1']), rev) | 
| + self.assertEquals(scm._Capture(['rev-parse', 'HEAD^2']), | 
| + scm._Capture(['rev-parse', 'origin/master'])) | 
| + sys.stdout.close() | 
| + | 
| + def testUpdateRebase(self): | 
| + if not self.enabled: | 
| + return | 
| + options = self.Options() | 
| + scm = gclient_scm.CreateSCM(url=self.url, root_dir=self.root_dir, | 
| + relpath=self.relpath) | 
| + scm._Run(['checkout', '-q', 'feature'], options) | 
| + rev = scm.revinfo(options, (), None) | 
| + file_list = [] | 
| + # Fake a 'y' key press. | 
| + __builtin__.raw_input = lambda x: 'y' | 
| 
 
iannucci
2014/01/21 21:40:47
scary :). Does this automatically get set back to
 
Bernhard Bauer
2014/01/21 23:03:54
I have to admit, I stole this from updateConflict
 
iannucci
2014/01/21 23:23:29
Heh, fair enough... as long as they're both the sa
 
Bernhard Bauer
2014/01/22 15:59:50
OK, I made it a method on |scm| which I can overri
 
 | 
| + scm.update(options, (), file_list) | 
| + self.assertEquals(file_list, [join(self.base_path, x) | 
| + for x in ['a', 'b', 'c']]) | 
| + # The actual commit that is created is unstable, so we verify its tree and | 
| + # parent instead. | 
| + self.assertEquals(scm._Capture(['show', '--format=%T', '-s']), | 
| + 'd2e35c10ac24d6c621e14a1fcadceb533155627d') | 
| + self.assertEquals(scm._Capture(['rev-parse', 'HEAD^']), | 
| + scm._Capture(['rev-parse', 'origin/master'])) | 
| + sys.stdout.close() | 
| + | 
| def testUpdateReset(self): | 
| if not self.enabled: | 
| return |