@@ -32,7 +32,7 @@ def _update_repo(repo_config, runner, tags_only):
3232 Args:
3333 repo_config - A config for a repository
3434 """
35- repo_path = runner .store .clone (repo_config ['repo' ], repo_config ['sha ' ])
35+ repo_path = runner .store .clone (repo_config ['repo' ], repo_config ['rev ' ])
3636
3737 cmd_output ('git' , '-C' , repo_path , 'fetch' )
3838 tag_cmd = ('git' , '-C' , repo_path , 'describe' , 'origin/master' , '--tags' )
@@ -46,13 +46,13 @@ def _update_repo(repo_config, runner, tags_only):
4646 tag_cmd = ('git' , '-C' , repo_path , 'rev-parse' , 'origin/master' )
4747 rev = cmd_output (* tag_cmd )[1 ].strip ()
4848
49- # Don't bother trying to update if our sha is the same
50- if rev == repo_config ['sha ' ]:
49+ # Don't bother trying to update if our rev is the same
50+ if rev == repo_config ['rev ' ]:
5151 return repo_config
5252
53- # Construct a new config with the head sha
53+ # Construct a new config with the head rev
5454 new_config = OrderedDict (repo_config )
55- new_config ['sha ' ] = rev
55+ new_config ['rev ' ] = rev
5656 new_repo = Repository .create (new_config , runner .store )
5757
5858 # See if any of our hooks were deleted with the new commits
@@ -67,8 +67,8 @@ def _update_repo(repo_config, runner, tags_only):
6767 return new_config
6868
6969
70- SHA_LINE_RE = re .compile (r'^(\s+)sha :(\s*)([^\s#]+)(.*)$' , re .DOTALL )
71- SHA_LINE_FMT = '{}sha :{}{}{}'
70+ REV_LINE_RE = re .compile (r'^(\s+)rev :(\s*)([^\s#]+)(.*)$' , re .DOTALL )
71+ REV_LINE_FMT = '{}rev :{}{}{}'
7272
7373
7474def _write_new_config_file (path , output ):
@@ -77,25 +77,25 @@ def _write_new_config_file(path, output):
7777 new_contents = ordered_dump (output , ** C .YAML_DUMP_KWARGS )
7878
7979 lines = original_contents .splitlines (True )
80- sha_line_indices_rev = list (reversed ([
81- i for i , line in enumerate (lines ) if SHA_LINE_RE .match (line )
80+ rev_line_indices_reversed = list (reversed ([
81+ i for i , line in enumerate (lines ) if REV_LINE_RE .match (line )
8282 ]))
8383
8484 for line in new_contents .splitlines (True ):
85- if SHA_LINE_RE .match (line ):
86- # It's possible we didn't identify the sha lines in the original
87- if not sha_line_indices_rev :
85+ if REV_LINE_RE .match (line ):
86+ # It's possible we didn't identify the rev lines in the original
87+ if not rev_line_indices_reversed :
8888 break
89- line_index = sha_line_indices_rev .pop ()
89+ line_index = rev_line_indices_reversed .pop ()
9090 original_line = lines [line_index ]
91- orig_match = SHA_LINE_RE .match (original_line )
92- new_match = SHA_LINE_RE .match (line )
93- lines [line_index ] = SHA_LINE_FMT .format (
91+ orig_match = REV_LINE_RE .match (original_line )
92+ new_match = REV_LINE_RE .match (line )
93+ lines [line_index ] = REV_LINE_FMT .format (
9494 orig_match .group (1 ), orig_match .group (2 ),
9595 new_match .group (3 ), orig_match .group (4 ),
9696 )
9797
98- # If we failed to intelligently rewrite the sha lines, fall back to the
98+ # If we failed to intelligently rewrite the rev lines, fall back to the
9999 # pretty-formatted yaml output
100100 to_write = '' .join (lines )
101101 if remove_defaults (ordered_load (to_write ), CONFIG_SCHEMA ) != output :
@@ -132,10 +132,10 @@ def autoupdate(runner, tags_only, repos=()):
132132 retv = 1
133133 continue
134134
135- if new_repo_config ['sha ' ] != repo_config ['sha ' ]:
135+ if new_repo_config ['rev ' ] != repo_config ['rev ' ]:
136136 changed = True
137137 output .write_line ('updating {} -> {}.' .format (
138- repo_config ['sha ' ], new_repo_config ['sha ' ],
138+ repo_config ['rev ' ], new_repo_config ['rev ' ],
139139 ))
140140 output_repos .append (new_repo_config )
141141 else :
0 commit comments