From 9c9669d3617da397ec5efe4d1aceb27897153d52 Mon Sep 17 00:00:00 2001 From: MokhamedDakhraui <43042705+MokhamedDakhraui@users.noreply.github.com> Date: Wed, 22 Jan 2020 21:50:37 +0300 Subject: [PATCH] Check .hgsub and .hgsubstate files to detect subrepo changes --- hg-fast-export.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hg-fast-export.py b/hg-fast-export.py index 8e3449a..f176239 100755 --- a/hg-fast-export.py +++ b/hg-fast-export.py @@ -191,8 +191,10 @@ def refresh_gitmodules(ctx): def export_file_contents(ctx,manifest,files,hgtags,encoding='',plugins={}): count=0 max=len(files) + is_submodules_refreshed=False for file in files: - if file==".hgsubstate": + if not is_submodules_refreshed and (file=='.hgsub' or file=='.hgsubstate'): + is_submodules_refreshed=True refresh_gitmodules(ctx) # Skip .hgtags files. They only get us in trouble. if not hgtags and file == ".hgtags": @@ -336,7 +338,7 @@ def export_commit(ui,repo,revision,old_marks,max,count,authors, if fn_encoding: filename=filename.decode(fn_encoding).encode('utf8') filename=strip_leading_slash(filename) - if filename=='.hgsubstate': + if filename=='.hgsub': remove_gitmodules(ctx) wr('D %s' % filename)