mirror of
https://github.com/frej/fast-export.git
synced 2026-02-27 06:50:41 +01:00
Allow name sanitizer to be disabled with --no-auto-sanitize
Make it possible to completely disable the name sanitizer by the --no-auto-sanitize flag. Previously the sanitizer was run on user remapped names. As the sanitizer rewrites perfectly legal git names (such as __.*) this is probably not what the user wants. Closes #155.
This commit is contained in:
@@ -101,6 +101,12 @@ name the -B and -T options allow a mapping file to be specified to
|
||||
rename branches and tags (respectively). The syntax of the mapping
|
||||
file is the same as for the author mapping.
|
||||
|
||||
When the -B and -T flags are used, you will probably want to use the
|
||||
-n flag to disable the built-in (broken in many cases) sanitizing of
|
||||
branch/tag names. In the future -n will become the default, but in
|
||||
order to not break existing incremental conversions, the default
|
||||
remains with the old behavior.
|
||||
|
||||
Content filtering
|
||||
-----------------
|
||||
|
||||
|
||||
@@ -31,6 +31,10 @@ cfg_export_boundary=1000
|
||||
subrepo_cache={}
|
||||
submodule_mappings=None
|
||||
|
||||
# True if fast export should automatically try to sanitize
|
||||
# author/branch/tag names.
|
||||
auto_sanitize = None
|
||||
|
||||
def gitmode(flags):
|
||||
return 'l' in flags and '120000' or 'x' in flags and '100755' or '100644'
|
||||
|
||||
@@ -226,6 +230,8 @@ def sanitize_name(name,what="branch", mapping={}):
|
||||
if name[0] == '.': return '_'+name[1:]
|
||||
return name
|
||||
|
||||
if not auto_sanitize:
|
||||
return mapping.get(name,name)
|
||||
n=mapping.get(name,name)
|
||||
p=re.compile('([[ ~^:?\\\\*]|\.\.)')
|
||||
n=p.sub('_', n)
|
||||
@@ -532,6 +538,9 @@ if __name__=='__main__':
|
||||
|
||||
parser=OptionParser()
|
||||
|
||||
parser.add_option("-n", "--no-auto-sanitize",action="store_false",
|
||||
dest="auto_sanitize",default=True,
|
||||
help="Do not perform built-in (broken in many cases) sanitizing of names")
|
||||
parser.add_option("-m","--max",type="int",dest="max",
|
||||
help="Maximum hg revision to import")
|
||||
parser.add_option("--mapping",dest="mappingfile",
|
||||
@@ -580,6 +589,7 @@ if __name__=='__main__':
|
||||
(options,args)=parser.parse_args()
|
||||
|
||||
m=-1
|
||||
auto_sanitize = options.auto_sanitize
|
||||
if options.max!=None: m=options.max
|
||||
|
||||
if options.marksfile==None: bail(parser,'--marks')
|
||||
|
||||
@@ -70,6 +70,8 @@ Options:
|
||||
-B <file> Read branch map from file
|
||||
-T <file> Read tags map from file
|
||||
-M <name> Set the default branch name (defaults to 'master')
|
||||
-n Do not perform built-in (broken in many cases) sanitizing
|
||||
of branch/tag names.
|
||||
-o <name> Use <name> as branch namespace to track upstream (eg 'origin')
|
||||
--hg-hash Annotate commits with the hg hash as git notes in the
|
||||
hg namespace.
|
||||
|
||||
Reference in New Issue
Block a user