Skip to content

Commit 22148e3

Browse files
committed
[update-checkout] Fix --dump-hashes for my changes around adding support for specifying the source root from update-checkout itself.
With a test to make sure I don't break it again!
1 parent b951eed commit 22148e3

File tree

3 files changed

+38
-1
lines changed

3 files changed

+38
-1
lines changed

utils/update_checkout/tests/scheme_mock.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@
3636
}
3737

3838
MOCK_CONFIG = {
39+
# This is here just b/c we expect it. We should consider consolidating
40+
# clone-patterns into a dictionary where we map protocols (i.e. ['ssh,
41+
# 'https'] to patterns). Then we can define this issue.
42+
'ssh-clone-pattern': 'DO_NOT_USE',
3943
# We reset this value with our remote path when we process
4044
'https-clone-pattern': '',
4145
'repos': {
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# ===--- test_dump.py -----------------------------------------------------===#
2+
#
3+
# This source file is part of the Swift.org open source project
4+
#
5+
# Copyright (c) 2014 - 2018 Apple Inc. and the Swift project authors
6+
# Licensed under Apache License v2.0 with Runtime Library Exception
7+
#
8+
# See https:#swift.org/LICENSE.txt for license information
9+
# See https:#swift.org/CONTRIBUTORS.txt for the list of Swift project authors
10+
#
11+
# ===----------------------------------------------------------------------===#
12+
13+
import scheme_mock
14+
15+
16+
class DumpTestCase(scheme_mock.SchemeMockTestCase):
17+
18+
def __init__(self, *args, **kwargs):
19+
super(DumpTestCase, self).__init__(*args, **kwargs)
20+
21+
def test_dump_hashes_json(self):
22+
# First do the clone.
23+
self.call([self.update_checkout_path,
24+
'--config', self.config_path,
25+
'--source-root', self.source_root,
26+
'--clone'])
27+
28+
# Then dump the hashes. Just make sure we don't crash. We should test
29+
# the output as well. But we should never crash.
30+
self.call([self.update_checkout_path,
31+
'--config', self.config_path,
32+
'--source-root', self.source_root,
33+
'--dump-hashes'])

utils/update_checkout/update_checkout/update_checkout.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ def main():
514514
validate_config(config)
515515

516516
if args.dump_hashes:
517-
dump_repo_hashes(config)
517+
dump_repo_hashes(args, config)
518518
return (None, None)
519519

520520
if args.dump_hashes_config:

0 commit comments

Comments
 (0)