otherwise the SHA1 from the cache."""
return marks.get(str(parent),':%d' % (parent+1))
-def mismatch(f1,f2):
+def file_mismatch(f1,f2):
"""See if two revisions of a file are not equal."""
return node.hex(f1)!=node.hex(f2)
-def outer_set(dleft,dright,l,c,r):
+def split_dict(dleft,dright,l=[],c=[],r=[],match=file_mismatch):
"""Loop over our repository and find all changed and missing files."""
for left in dleft.keys():
right=dright.get(left,None)
if right==None:
# we have the file but our parent hasn't: add to left set
l.append(left)
- elif mismatch(dleft[left],right):
+ elif match(dleft[left],right):
# we have it but checksums mismatch: add to center set
c.append(left)
for right in dright.keys():
for p in parents:
if p<0: continue
mright=repo.changectx(p).manifest()
- dleft=mleft.keys()
- dleft.sort()
- dright=mright.keys()
- dright.sort()
- l,c,r=outer_set(mleft,mright,l,c,r)
+ l,c,r=split_dict(mleft,mright,l,c,r)
+ l.sort()
+ c.sort()
+ r.sort()
return l,c,r
def get_author(logmessage,committer,authors):
def export_file_contents(ctx,manifest,files):
count=0
- files.sort()
max=len(files)
for file in files:
- fctx=ctx.filectx(file)
- d=fctx.data()
+ d=ctx.filectx(file).data()
wr('M %s inline %s' % (gitmode(manifest.execf(file)),file))
wr('data %d' % len(d)) # had some trouble with size()
wr(d)
if revision==0:
# first revision: feed in full manifest
added=man.keys()
+ added.sort()
type='full'
elif is_merge(parents):
# later merge revision: feed in changed manifest
(branch,type,revision+1,max,len(added),len(changed),len(removed)))
map(lambda r: wr('D %s' % r),removed)
- export_file_contents(ctx,man,added+changed)
+ export_file_contents(ctx,man,added)
+ export_file_contents(ctx,man,changed)
wr()
return checkpoint(count)