Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F30875382
raw.txt
No One
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Authored By
hashar
Oct 22 2019, 1:16 PM
2019-10-22 13:16:13 (UTC+0)
Size
1 KB
Referenced Files
None
Subscribers
None
raw.txt
View Options
#!/usr/bin/env python3
import re
import unittest
from collections import defaultdict
def parse_path(path):
# Example:
# ./eventlogging.git/refs/changes/44/544144/meta:b6950bfe08fd59a63dfbcc4ff3b5ecfa5da43dcd
m = re.match('^./(.*)\.git/(.+/meta)$', path)
# (repo, ref)
return (m[1], m[2])
def parse_file(fname):
stuff = defaultdict(dict)
with open(fname) as f:
print("Reading %s" % fname)
for line in f.readlines():
(path, sha1) = line.rstrip().split(':')
(repo, ref) = parse_path(path)
stuff[repo][ref] = sha1
return stuff
refs = {}
repos = set()
for host in ('cobalt', 'gerrit1001'):
refs[host] = parse_file('%s-meta-files.txt' % host)
repos = repos.union(set(refs[host].keys()))
print('Found %s repositories.' % len(repos))
for repo in sorted(repos):
testcase = unittest.TestCase()
testcase.maxDiff = None
try:
testcase.assertDictEqual(refs['cobalt'][repo], refs['gerrit1001'][repo])
except AssertionError as e:
print("FAIL %s: %s" % (repo, e))
pass
else:
print("OK %s" % repo)
File Metadata
Details
Attached
Mime Type
text/plain; charset=utf-8
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
8143747
Default Alt Text
raw.txt (1 KB)
Attached To
Mode
P9435 compare-meta-refs.py
Attached
Detach File
Event Timeline
Log In to Comment