assert(oldpack.endswith('.idx'))
(dir,name) = os.path.split(oldpack)
if not (name in suggested):
- debug1("bup server: suggesting index %s\n" % name)
+ debug1("bup server: suggesting index %s\n"
+ % git.shorten_hash(name))
debug1("bup server: because of object %s\n"
% shar.encode('hex'))
conn.write('index %s\n' % name)
debug2('%s\n' % line)
if line.startswith('index '):
idx = line[6:]
- debug1('client: received index suggestion: %s\n' % idx)
+ debug1('client: received index suggestion: %s\n'
+ % git.shorten_hash(idx))
suggested.append(idx)
else:
assert(line.endswith('.idx'))
- debug1('client: completed writing pack, idx: %s\n' % line)
+ debug1('client: completed writing pack, idx: %s\n'
+ % git.shorten_hash(line))
suggested.append(line)
self.check_ok()
if ob:
return os.path.join(repodir, sub)
+def shorten_hash(s):
+ return re.sub(r'([^0-9a-z]|\b)([0-9a-z]{7})[0-9a-z]{33}([^0-9a-z]|\b)',
+ r'\1\2*\3', s)
+
+
def repo_rel(path):
full = os.path.abspath(path)
fullrepo = os.path.abspath(repo(''))
path = full[len(fullrepo):]
if path.startswith('index-cache/'):
path = path[len('index-cache/'):]
- return path
+ return shorten_hash(path)
def all_packdirs():