vcssync: eliminate shamap_path variable (
bug 1357597); r?glob
The value is redundant with rev_map and not necessary. Given the
state of mind I was in when I wrote this code (I was rushing to
get this feature deployed), I'm not surprised this slipped through.
MozReview-Commit-ID: 98Sbs4aDU1o
--- a/vcssync/mozvcssync/git2hg.py
+++ b/vcssync/mozvcssync/git2hg.py
@@ -248,22 +248,21 @@ def linearize_git_repo_to_hg(git_source_
if not os.path.exists(hg_repo_path):
hglib.init(hg_repo_path)
with hglib.open(hg_repo_path) as hrepo:
tip = hrepo[b'tip']
before_hg_tip_rev = tip.rev()
before_hg_tip_node = tip.node()
- shamap_path = os.path.join(hg_repo_path, b'.hg', b'shamap')
def get_shamap_hash():
- if not os.path.exists(shamap_path):
+ if not os.path.exists(rev_map):
return None
- with open(shamap_path, 'rb') as fh:
+ with open(rev_map, 'rb') as fh:
return hashlib.sha256(fh.read()).digest()
old_shamap_hash = get_shamap_hash()
run_hg_convert(git_repo_path, hg_repo_path, rev_map,
rev=b'refs/convert/dest/heads/%s' % ref,
similarity=similarity,
find_copies_harder=find_copies_harder,
@@ -291,12 +290,12 @@ def linearize_git_repo_to_hg(git_source_
convert_count, before_hg_tip_rev, before_hg_tip_node,
after_hg_tip_rev, after_hg_tip_node))
maybe_push_hg()
# TODO so hacky. Relies on credentials in the environment.
if shamap_s3_upload_url and old_shamap_hash != get_shamap_hash():
subprocess.check_call([
- b'aws', b's3', b'cp', shamap_path, shamap_s3_upload_url
+ b'aws', b's3', b'cp', rev_map, shamap_s3_upload_url
])
return result