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

Side by Side Diff: tests/git_common_test.py

Issue 536793002: Skip tracking status in map-branches when -v flag is not supplied. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: change method name Created 6 years, 3 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
« no previous file with comments | « git_map_branches.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2013 The Chromium Authors. All rights reserved. 2 # Copyright 2013 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Unit tests for git_common.py""" 6 """Unit tests for git_common.py"""
7 7
8 import binascii 8 import binascii
9 import collections 9 import collections
10 import os 10 import os
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 self.assertEquals(self.repo.run(self.gc.upstream, 'bobly'), None) 365 self.assertEquals(self.repo.run(self.gc.upstream, 'bobly'), None)
366 self.assertEquals(self.repo.run(self.gc.upstream, 'master'), None) 366 self.assertEquals(self.repo.run(self.gc.upstream, 'master'), None)
367 self.repo.git('checkout', '-tb', 'happybranch', 'master') 367 self.repo.git('checkout', '-tb', 'happybranch', 'master')
368 self.assertEquals(self.repo.run(self.gc.upstream, 'happybranch'), 368 self.assertEquals(self.repo.run(self.gc.upstream, 'happybranch'),
369 'master') 369 'master')
370 370
371 def testNormalizedVersion(self): 371 def testNormalizedVersion(self):
372 self.assertTrue(all( 372 self.assertTrue(all(
373 isinstance(x, int) for x in self.repo.run(self.gc.get_git_version))) 373 isinstance(x, int) for x in self.repo.run(self.gc.get_git_version)))
374 374
375 def testGetAllTrackingInfo(self): 375 def testGetBranchesInfo(self):
376 self.repo.git('commit', '--allow-empty', '-am', 'foooooo') 376 self.repo.git('commit', '--allow-empty', '-am', 'foooooo')
377 self.repo.git('checkout', '-tb', 'happybranch', 'master') 377 self.repo.git('checkout', '-tb', 'happybranch', 'master')
378 self.repo.git('commit', '--allow-empty', '-am', 'foooooo') 378 self.repo.git('commit', '--allow-empty', '-am', 'foooooo')
379 self.repo.git('checkout', '-tb', 'child', 'happybranch') 379 self.repo.git('checkout', '-tb', 'child', 'happybranch')
380 380
381 self.repo.git('checkout', '-tb', 'to_delete', 'master') 381 self.repo.git('checkout', '-tb', 'to_delete', 'master')
382 self.repo.git('checkout', '-tb', 'parent_gone', 'to_delete') 382 self.repo.git('checkout', '-tb', 'parent_gone', 'to_delete')
383 self.repo.git('branch', '-D', 'to_delete') 383 self.repo.git('branch', '-D', 'to_delete')
384 384
385 actual = self.repo.run(self.gc.get_all_tracking_info)
386 supports_track = ( 385 supports_track = (
387 self.repo.run(self.gc.get_git_version) 386 self.repo.run(self.gc.get_git_version)
388 >= self.gc.MIN_UPSTREAM_TRACK_GIT_VERSION) 387 >= self.gc.MIN_UPSTREAM_TRACK_GIT_VERSION)
388 actual = self.repo.run(self.gc.get_branches_info, supports_track)
389 389
390 expected = { 390 expected = {
391 'happybranch': ( 391 'happybranch': (
392 self.repo.run(self.gc.hash_one, 'happybranch', short=True), 392 self.repo.run(self.gc.hash_one, 'happybranch', short=True),
393 'master', 393 'master',
394 1 if supports_track else None, 394 1 if supports_track else None,
395 None 395 None
396 ), 396 ),
397 'child': ( 397 'child': (
398 self.repo.run(self.gc.hash_one, 'child', short=True), 398 self.repo.run(self.gc.hash_one, 'child', short=True),
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
704 704
705 self.assertEquals(self.repo.git('status', '--porcelain').stdout, STATUS_1) 705 self.assertEquals(self.repo.git('status', '--porcelain').stdout, STATUS_1)
706 706
707 self.repo.run(inner) 707 self.repo.run(inner)
708 708
709 709
710 if __name__ == '__main__': 710 if __name__ == '__main__':
711 sys.exit(coverage_utils.covered_main( 711 sys.exit(coverage_utils.covered_main(
712 os.path.join(DEPOT_TOOLS_ROOT, 'git_common.py') 712 os.path.join(DEPOT_TOOLS_ROOT, 'git_common.py')
713 )) 713 ))
OLDNEW
« no previous file with comments | « git_map_branches.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698