• Home
  • Raw
  • Download

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))
121 def translate_sha_to_rev(llvm_config: LLVMConfig, sha_or_ref: str) -> Rev:
122 """Translates a sha or git ref to a Rev."""
128 ["git", "rev-parse", sha_or_ref],
143 "rev-list",
151 return Rev(branch=MAIN_BRANCH, number=count + base_llvm_revision)
161 return Rev(branch=MAIN_BRANCH, number=merge_base_number)
166 "rev-list",
204 return Rev(branch=candidates[0], number=revision_number)
246 def translate_prebase_rev_to_sha(llvm_config: LLVMConfig, rev: Rev) -> str: argument
247 """Translates a Rev to a SHA.
249 This function assumes that the given rev refers to a commit that's an
255 looking_for = f"llvm-svn: {rev.number}"
283 raise ValueError(f"No commit with revision {rev} found")
286 def translate_rev_to_sha(llvm_config: LLVMConfig, rev: Rev) -> str: argument
287 """Translates a Rev to a SHA.
289 Raises a ValueError if the given Rev doesn't exist in the given config.
291 branch, number = rev
295 return translate_prebase_rev_to_sha(llvm_config, rev)
317 # about rev walking/counting locally compared to long |log|s, so we walk back
320 ["git", "rev-parse", f"{llvm_config.remote}/{branch}"],
329 "rev-list",
341 f"Revision {rev} is past {llvm_config.remote}/{branch}. Try updating "
346 ["git", "rev-parse", f"{branch_head_sha}~{commits_behind_head}"],
359 ["git", "rev-parse", "--show-toplevel"],
379 "--sha", help="A git SHA (or ref) to convert to a rev"
381 sha_or_rev.add_argument("--rev", help="A rev to convert into a sha")
399 rev = translate_sha_to_rev(config, opts.sha)
400 print(rev)
402 sha = translate_rev_to_sha(config, Rev.parse(opts.rev))