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

Side by Side Diff: infra/libs/git2/test/repo_test.py

Issue 424423004: Push pending tag and synthesized commit in a single git push operation. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Created 6 years, 4 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 unified diff | Download patch
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import hashlib 5 import hashlib
6 import shutil 6 import shutil
7 import sys 7 import sys
8 8
9 from infra.libs import git2 9 from infra.libs import git2
10 from infra.libs.git2.test import test_util 10 from infra.libs.git2.test import test_util
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 def testIntern(self): 90 def testIntern(self):
91 r = self.mkRepo() 91 r = self.mkRepo()
92 hsh = r.intern('catfood') 92 hsh = r.intern('catfood')
93 self.assertEqual(hsh, hashlib.sha1('blob 7\0catfood').hexdigest()) 93 self.assertEqual(hsh, hashlib.sha1('blob 7\0catfood').hexdigest())
94 self.assertEqual('catfood', r.run('cat-file', 'blob', hsh)) 94 self.assertEqual('catfood', r.run('cat-file', 'blob', hsh))
95 95
96 def testGetRef(self): 96 def testGetRef(self):
97 r = self.mkRepo() 97 r = self.mkRepo()
98 self.assertEqual(r['refs/heads/branch_Z'].commit.hsh, 98 self.assertEqual(r['refs/heads/branch_Z'].commit.hsh,
99 'c9813df312aae7cadb91b0d4eb89ad1a4d1b22c9') 99 'c9813df312aae7cadb91b0d4eb89ad1a4d1b22c9')
100
101 def testNonFastForward(self):
102 r = self.mkRepo()
103 O = r['refs/heads/branch_O']
104 D = r.get_commit(self.repo['D'])
105 with self.assertRaises(git2.CalledProcessError):
106 r.fast_forward_push({O: D})
107 self.assertEqual(
108 self.repo.git('rev-parse', 'branch_O').stdout.strip(),
109 self.repo['O'])
110
111 def testFastForward(self):
112 r = self.mkRepo()
113 O = r['refs/heads/branch_O']
114 S = r.get_commit(self.repo['S'])
115 self.capture_stdio(r.fast_forward_push, {O: S})
116 self.assertEqual(O.commit.hsh, self.repo['S'])
117 self.assertEqual(
118 self.repo.git('rev-parse', 'branch_O').stdout.strip(),
119 self.repo['S'])
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698