Lines Matching full:rev
44 class Rev(t.NamedTuple('Rev', (('branch', str), ('number', int)))): class
48 def parse(rev: str) -> 'Rev':
49 """Parses a Rev from the given string.
58 if rev.startswith('r'):
60 rev_string = rev[1:]
62 match = re.match(r'\((.+), r(\d+)\)', rev)
64 raise ValueError("%r isn't a valid revision" % rev)
68 return Rev(branch=branch_name, number=int(rev_string))
116 def translate_sha_to_rev(llvm_config: LLVMConfig, sha_or_ref: str) -> Rev:
117 """Translates a sha or git ref to a Rev."""
123 ['git', 'rev-parse', sha_or_ref],
138 'rev-list',
146 return Rev(branch=MAIN_BRANCH, number=count + base_llvm_revision)
155 return Rev(branch=MAIN_BRANCH, number=merge_base_number)
160 'rev-list',
191 return Rev(branch=candidates[0], number=revision_number)
232 def translate_prebase_rev_to_sha(llvm_config: LLVMConfig, rev: Rev) -> str: argument
233 """Translates a Rev to a SHA.
235 This function assumes that the given rev refers to a commit that's an
241 looking_for = f'llvm-svn: {rev.number}'
265 raise ValueError(f'No commit with revision {rev} found')
268 def translate_rev_to_sha(llvm_config: LLVMConfig, rev: Rev) -> str: argument
269 """Translates a Rev to a SHA.
271 Raises a ValueError if the given Rev doesn't exist in the given config.
273 branch, number = rev
277 return translate_prebase_rev_to_sha(llvm_config, rev)
293 # about rev walking/counting locally compared to long |log|s, so we walk back
296 ['git', 'rev-parse', f'{llvm_config.remote}/{branch}'],
305 'rev-list',
317 f'Revision {rev} is past {llvm_config.remote}/{branch}. Try updating '
321 ['git', 'rev-parse', f'{branch_head_sha}~{commits_behind_head}'],
334 ['git', 'rev-parse', '--show-toplevel'],
352 '--sha', help='A git SHA (or ref) to convert to a rev')
353 sha_or_rev.add_argument('--rev', help='A rev to convert into a sha')
369 rev = translate_sha_to_rev(config, opts.sha)
370 print(rev)
372 sha = translate_rev_to_sha(config, Rev.parse(opts.rev))