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

Side by Side Diff: tests/git_cl_test.py

Issue 2489963003: Don't --find-copies-harder when printing informational diff, either (Closed)
Patch Set: update test Created 4 years, 1 month 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_cl.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 (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 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_cl.py.""" 6 """Unit tests for git_cl.py."""
7 7
8 import json 8 import json
9 import os 9 import os
10 import StringIO 10 import StringIO
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 find_copies = True 396 find_copies = True
397 find_copies_call = ((['git', 'config', '--bool', 397 find_copies_call = ((['git', 'config', '--bool',
398 'branch.master.git-find-copies'],), CERR1) 398 'branch.master.git-find-copies'],), CERR1)
399 else: 399 else:
400 val = str(find_copies).lower() 400 val = str(find_copies).lower()
401 find_copies_call = ((['git', 'config', '--bool', 401 find_copies_call = ((['git', 'config', '--bool',
402 'branch.master.git-find-copies', val],), '') 402 'branch.master.git-find-copies', val],), '')
403 403
404 if find_copies: 404 if find_copies:
405 stat_call = ((['git', 'diff', '--no-ext-diff', '--stat', 405 stat_call = ((['git', 'diff', '--no-ext-diff', '--stat',
406 '--find-copies-harder', '-l100000', '-C'+similarity, 406 '-l100000', '-C'+similarity,
407 'fake_ancestor_sha', 'HEAD'],), '+dat') 407 'fake_ancestor_sha', 'HEAD'],), '+dat')
408 else: 408 else:
409 stat_call = ((['git', 'diff', '--no-ext-diff', '--stat', 409 stat_call = ((['git', 'diff', '--no-ext-diff', '--stat',
410 '-M'+similarity, 'fake_ancestor_sha', 'HEAD'],), '+dat') 410 '-M'+similarity, 'fake_ancestor_sha', 'HEAD'],), '+dat')
411 411
412 return [ 412 return [
413 ((['git', 'symbolic-ref', 'HEAD'],), 'master'), 413 ((['git', 'symbolic-ref', 'HEAD'],), 'master'),
414 similarity_call, 414 similarity_call,
415 ((['git', 'symbolic-ref', 'HEAD'],), 'master'), 415 ((['git', 'symbolic-ref', 'HEAD'],), 'master'),
416 find_copies_call, 416 find_copies_call,
417 ] + cls._is_gerrit_calls() + [ 417 ] + cls._is_gerrit_calls() + [
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 def _dcommit_calls_bypassed(cls): 581 def _dcommit_calls_bypassed(cls):
582 return [ 582 return [
583 ((['git', 'config', 'branch.working.rietveldserver'],), 583 ((['git', 'config', 'branch.working.rietveldserver'],),
584 'codereview.example.com'), 584 'codereview.example.com'),
585 ] 585 ]
586 586
587 @classmethod 587 @classmethod
588 def _dcommit_calls_3(cls): 588 def _dcommit_calls_3(cls):
589 return [ 589 return [
590 ((['git', 590 ((['git',
591 'diff', '--no-ext-diff', '--stat', '--find-copies-harder', 591 'diff', '--no-ext-diff', '--stat', '-l100000', '-C50',
592 '-l100000', '-C50', 'fake_ancestor_sha', 592 'fake_ancestor_sha', 'refs/heads/working'],),
593 'refs/heads/working'],),
594 (' PRESUBMIT.py | 2 +-\n' 593 (' PRESUBMIT.py | 2 +-\n'
595 ' 1 files changed, 1 insertions(+), 1 deletions(-)\n')), 594 ' 1 files changed, 1 insertions(+), 1 deletions(-)\n')),
596 ((['git', 'show-ref', '--quiet', '--verify', 595 ((['git', 'show-ref', '--quiet', '--verify',
597 'refs/heads/git-cl-commit'],), ''), 596 'refs/heads/git-cl-commit'],), ''),
598 ((['git', 'branch', '-D', 'git-cl-commit'],), ''), 597 ((['git', 'branch', '-D', 'git-cl-commit'],), ''),
599 ((['git', 'show-ref', '--quiet', '--verify', 598 ((['git', 'show-ref', '--quiet', '--verify',
600 'refs/heads/git-cl-cherry-pick'],), CERR1), 599 'refs/heads/git-cl-cherry-pick'],), CERR1),
601 ((['git', 'rev-parse', '--show-cdup'],), '\n'), 600 ((['git', 'rev-parse', '--show-cdup'],), '\n'),
602 ((['git', 'checkout', '-q', '-b', 'git-cl-commit'],), ''), 601 ((['git', 'checkout', '-q', '-b', 'git-cl-commit'],), ''),
603 ((['git', 'reset', '--soft', 'fake_ancestor_sha'],), ''), 602 ((['git', 'reset', '--soft', 'fake_ancestor_sha'],), ''),
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
850 'fake_ancestor_sha...', '.'],), 849 'fake_ancestor_sha...', '.'],),
851 'M\t.gitignore\n'), 850 'M\t.gitignore\n'),
852 ((['git', 'config', 'branch.master.gerritpatchset'],), CERR1), 851 ((['git', 'config', 'branch.master.gerritpatchset'],), CERR1),
853 ] + ([] if issue else [ 852 ] + ([] if issue else [
854 ((['git', 853 ((['git',
855 'log', '--pretty=format:%s%n%n%b', 'fake_ancestor_sha...'],), 854 'log', '--pretty=format:%s%n%n%b', 'fake_ancestor_sha...'],),
856 'foo'), 855 'foo'),
857 ]) + [ 856 ]) + [
858 ((['git', 'config', 'user.email'],), 'me@example.com'), 857 ((['git', 'config', 'user.email'],), 'me@example.com'),
859 ((['git', 858 ((['git',
860 'diff', '--no-ext-diff', '--stat', '--find-copies-harder', 859 'diff', '--no-ext-diff', '--stat', '-l100000', '-C50',
861 '-l100000', '-C50', 'fake_ancestor_sha', 'HEAD'],), 860 'fake_ancestor_sha', 'HEAD'],),
862 '+dat'), 861 '+dat'),
863 ] 862 ]
864 863
865 @classmethod 864 @classmethod
866 def _gerrit_upload_calls(cls, description, reviewers, squash, 865 def _gerrit_upload_calls(cls, description, reviewers, squash,
867 squash_mode='default', 866 squash_mode='default',
868 expected_upstream_ref='origin/refs/heads/master', 867 expected_upstream_ref='origin/refs/heads/master',
869 ref_suffix='', notify=False, 868 ref_suffix='', notify=False,
870 post_amend_description=None, issue=None, cc=None): 869 post_amend_description=None, issue=None, cc=None):
871 if post_amend_description is None: 870 if post_amend_description is None:
(...skipping 1526 matching lines...) Expand 10 before | Expand all | Expand 10 after
2398 self.assertNotRegexpMatches(sys.stdout.getvalue(), 'Warning') 2397 self.assertNotRegexpMatches(sys.stdout.getvalue(), 'Warning')
2399 self.assertRegexpMatches(sys.stdout.getvalue(), '^Failures:') 2398 self.assertRegexpMatches(sys.stdout.getvalue(), '^Failures:')
2400 self.assertRegexpMatches(sys.stdout.getvalue(), 'Started:') 2399 self.assertRegexpMatches(sys.stdout.getvalue(), 'Started:')
2401 self.assertRegexpMatches(sys.stdout.getvalue(), '2 try jobs') 2400 self.assertRegexpMatches(sys.stdout.getvalue(), '2 try jobs')
2402 2401
2403 2402
2404 if __name__ == '__main__': 2403 if __name__ == '__main__':
2405 git_cl.logging.basicConfig( 2404 git_cl.logging.basicConfig(
2406 level=git_cl.logging.DEBUG if '-v' in sys.argv else git_cl.logging.ERROR) 2405 level=git_cl.logging.DEBUG if '-v' in sys.argv else git_cl.logging.ERROR)
2407 unittest.main() 2406 unittest.main()
OLDNEW
« no previous file with comments | « git_cl.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698