|
|
|
@ -30,7 +30,7 @@ import subprocess2
|
|
|
|
|
|
|
|
|
|
def write(path, content):
|
|
|
|
|
f = open(path, 'wb')
|
|
|
|
|
f.write(content)
|
|
|
|
|
f.write(content.encode())
|
|
|
|
|
f.close()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -52,12 +52,12 @@ def read_tree(tree_root):
|
|
|
|
|
|
|
|
|
|
def dict_diff(dict1, dict2):
|
|
|
|
|
diff = {}
|
|
|
|
|
for k, v in dict1.iteritems():
|
|
|
|
|
for k, v in dict1.items():
|
|
|
|
|
if k not in dict2:
|
|
|
|
|
diff[k] = v
|
|
|
|
|
elif v != dict2[k]:
|
|
|
|
|
diff[k] = (v, dict2[k])
|
|
|
|
|
for k, v in dict2.iteritems():
|
|
|
|
|
for k, v in dict2.items():
|
|
|
|
|
if k not in dict1:
|
|
|
|
|
diff[k] = v
|
|
|
|
|
return diff
|
|
|
|
@ -68,7 +68,8 @@ def commit_git(repo):
|
|
|
|
|
subprocess2.check_call(['git', 'add', '-A', '-f'], cwd=repo)
|
|
|
|
|
subprocess2.check_call(['git', 'commit', '-q', '--message', 'foo'], cwd=repo)
|
|
|
|
|
rev = subprocess2.check_output(
|
|
|
|
|
['git', 'show-ref', '--head', 'HEAD'], cwd=repo).split(' ', 1)[0]
|
|
|
|
|
['git', 'show-ref', '--head', 'HEAD'], cwd=repo).split(b' ', 1)[0]
|
|
|
|
|
rev = rev.decode('utf-8')
|
|
|
|
|
logging.debug('At revision %s' % rev)
|
|
|
|
|
return rev
|
|
|
|
|
|
|
|
|
@ -221,7 +222,7 @@ class FakeReposBase(object):
|
|
|
|
|
"""For a dictionary of file contents, generate a filesystem."""
|
|
|
|
|
if not os.path.isdir(root):
|
|
|
|
|
os.makedirs(root)
|
|
|
|
|
for (k, v) in tree_dict.iteritems():
|
|
|
|
|
for (k, v) in tree_dict.items():
|
|
|
|
|
k_os = k.replace('/', os.sep)
|
|
|
|
|
k_arr = k_os.split(os.sep)
|
|
|
|
|
if len(k_arr) > 1:
|
|
|
|
@ -301,7 +302,7 @@ class FakeReposBase(object):
|
|
|
|
|
repo_root = join(self.git_root, repo)
|
|
|
|
|
logging.debug('%s: fast-import %s', repo, data)
|
|
|
|
|
subprocess2.check_call(
|
|
|
|
|
['git', 'fast-import', '--quiet'], cwd=repo_root, stdin=data)
|
|
|
|
|
['git', 'fast-import', '--quiet'], cwd=repo_root, stdin=data.encode())
|
|
|
|
|
|
|
|
|
|
def check_port_is_free(self, port):
|
|
|
|
|
sock = socket.socket()
|
|
|
|
@ -966,7 +967,7 @@ class FakeReposTestBase(trial_dir.TestCase):
|
|
|
|
|
for item, new_root in args:
|
|
|
|
|
repo, rev = item.split('@', 1)
|
|
|
|
|
tree = self.gittree(repo, rev)
|
|
|
|
|
for k, v in tree.iteritems():
|
|
|
|
|
for k, v in tree.items():
|
|
|
|
|
result[join(new_root, k)] = v
|
|
|
|
|
return result
|
|
|
|
|
|
|
|
|
|