mirror of
				https://github.com/frej/fast-export.git
				synced 2025-10-31 16:35:48 +01:00 
			
		
		
		
	Coalesce modified files
Git doesn't care if they are added or changed: they are modified. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
This commit is contained in:
		| @@ -102,7 +102,7 @@ def get_filechanges(repo,revision,parents,mleft): | ||||
|   l.sort() | ||||
|   c.sort() | ||||
|   r.sort() | ||||
|   return l,c,r | ||||
|   return c+l,r | ||||
|  | ||||
| def get_author(logmessage,committer,authors): | ||||
|   """As git distincts between author and committer of a patch, try to | ||||
| @@ -332,11 +332,11 @@ def export_commit(ui,repo,revision,old_marks,max,count,authors, | ||||
|   wr_data(desc) | ||||
|  | ||||
|   man=ctx.manifest() | ||||
|   added,changed,removed,type=[],[],[],'' | ||||
|   modified,removed,type=[],[],'' | ||||
|  | ||||
|   if not parents: | ||||
|     # first revision: feed in full manifest | ||||
|     added=files | ||||
|     modified=files | ||||
|     type='full' | ||||
|   else: | ||||
|     wr(b'from %s' % revnum_to_revref(parents[0], old_marks)) | ||||
| @@ -345,19 +345,20 @@ def export_commit(ui,repo,revision,old_marks,max,count,authors, | ||||
|       # if we have exactly one parent, just take the changes from the | ||||
|       # manifest without expensively comparing checksums | ||||
|       f=repo.status(parents[0],revision) | ||||
|       added,changed,removed=f.added,f.modified,f.removed | ||||
|       modified=f.modified + f.added | ||||
|       removed=f.removed | ||||
|       type='simple delta' | ||||
|     else: # a merge with two parents | ||||
|       wr(b'merge %s' % revnum_to_revref(parents[1], old_marks)) | ||||
|       # later merge revision: feed in changed manifest | ||||
|       # for many files comparing checksums is expensive so only do it for | ||||
|       # merges where we really need it due to hg's revlog logic | ||||
|       added,changed,removed=get_filechanges(repo,revision,parents,man) | ||||
|       modified,removed=get_filechanges(repo,revision,parents,man) | ||||
|       type='thorough delta' | ||||
|  | ||||
|   stderr_buffer.write( | ||||
|     b'%s: Exporting %s revision %d/%d with %d/%d/%d added/changed/removed files\n' | ||||
|     % (branch, type.encode(), revision + 1, max, len(added), len(changed), len(removed)) | ||||
|     b'%s: Exporting %s revision %d/%d with %d/%d modified/removed files\n' | ||||
|     % (branch, type.encode(), revision + 1, max, len(modified), len(removed)) | ||||
|   ) | ||||
|  | ||||
|   for filename in removed: | ||||
| @@ -368,8 +369,7 @@ def export_commit(ui,repo,revision,old_marks,max,count,authors, | ||||
|       remove_gitmodules(ctx) | ||||
|     wr(b'D %s' % filename) | ||||
|  | ||||
|   export_file_contents(ctx,man,added,hgtags,fn_encoding,plugins) | ||||
|   export_file_contents(ctx,man,changed,hgtags,fn_encoding,plugins) | ||||
|   export_file_contents(ctx,man,modified,hgtags,fn_encoding,plugins) | ||||
|   wr() | ||||
|  | ||||
|   return checkpoint(count) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user