return r
return committer
-def export_file_contents(ctx,manifest,files):
+def export_file_contents(ctx,manifest,files,hgtags):
count=0
max=len(files)
for file in files:
# Skip .hgtags files. They only get us in trouble.
- if file == ".hgtags":
+ if not hgtags and file == ".hgtags":
sys.stderr.write('Skip %s\n' % (file))
continue
d=ctx.filectx(file).data()
sys.stderr.write('Warning: sanitized %s [%s] to [%s]\n' % (what,name,n))
return n
-def export_commit(ui,repo,revision,old_marks,max,count,authors,sob,brmap):
+def export_commit(ui,repo,revision,old_marks,max,count,authors,sob,brmap,hgtags):
def get_branchname(name):
if brmap.has_key(name):
return brmap[name]
(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)
- export_file_contents(ctx,man,changed)
+ export_file_contents(ctx,man,added,hgtags)
+ export_file_contents(ctx,man,changed,hgtags)
wr()
return checkpoint(count)
return True
-def hg2git(repourl,m,marksfile,mappingfile,headsfile,tipfile,authors={},sob=False,force=False):
+def hg2git(repourl,m,marksfile,mappingfile,headsfile,tipfile,authors={},sob=False,force=False,hgtags=False):
_max=int(m)
old_marks=load_cache(marksfile,lambda s: int(s)-1)
c=0
brmap={}
for rev in range(min,max):
- c=export_commit(ui,repo,rev,old_marks,max,c,authors,sob,brmap)
+ c=export_commit(ui,repo,rev,old_marks,max,c,authors,sob,brmap,hgtags)
state_cache['tip']=max
state_cache['repo']=repourl
help="URL of repo to import")
parser.add_option("-s",action="store_true",dest="sob",
default=False,help="Enable parsing Signed-off-by lines")
+ parser.add_option("--hgtags",action="store_true",dest="hgtags",
+ default=False,help="Enable exporting .hgtags files")
parser.add_option("-A","--authors",dest="authorfile",
help="Read authormap from AUTHORFILE")
parser.add_option("-f","--force",action="store_true",dest="force",
set_origin_name(options.origin_name)
sys.exit(hg2git(options.repourl,m,options.marksfile,options.mappingfile,options.headsfile,
- options.statusfile,authors=a,sob=options.sob,force=options.force))
+ options.statusfile,authors=a,sob=options.sob,force=options.force,hgtags=options.hgtags))
GFI_OPTS=""
PYTHON=${PYTHON:-python}
-USAGE="[--quiet] [-r <repo>] [--force] [-m <max>] [-s] [-A <file>] [-M <name>] [-o <name>]"
+USAGE="[--quiet] [-r <repo>] [--force] [-m <max>] [-s] [--hgtags] [-A <file>] [-M <name>] [-o <name>]"
LONG_USAGE="Import hg repository <repo> up to either tip or <max>
If <repo> is omitted, use last hg repository as obtained from state file,
GIT_DIR/$PFX-$SFX_STATE by default.
Note: The argument order matters.
Options:
- -m Maximum revision to import
- --quiet Passed to git-fast-import(1)
- -s Enable parsing Signed-off-by lines
- -A Read author map from file
- (Same as in git-svnimport(1) and git-cvsimport(1))
- -r Mercurial repository to import
- -M Set the default branch name (default to 'master')
- -o Use <name> as branch namespace to track upstream (eg 'origin')
- --force Ignore validation errors when converting, and pass --force
- to git-fast-import(1)
+ -m Maximum revision to import
+ --quiet Passed to git-fast-import(1)
+ -s Enable parsing Signed-off-by lines
+ --hgtags Enable exporting .hgtags files
+ -A Read author map from file
+ (Same as in git-svnimport(1) and git-cvsimport(1))
+ -r Mercurial repository to import
+ -M Set the default branch name (default to 'master')
+ -o Use <name> as branch namespace to track upstream (eg 'origin')
+ --force Ignore validation errors when converting, and pass --force
+ to git-fast-import(1)
"
. "$(git --exec-path)/git-sh-setup"