@@ -1915,7 +1915,10 @@ def __init__(self):
19151915 optparse .make_option ("--keep-path" , dest = "keepRepoPath" , action = 'store_true' ,
19161916 help = "Keep entire BRANCH/DIR/SUBDIR prefix during import" ),
19171917 optparse .make_option ("--use-client-spec" , dest = "useClientSpec" , action = 'store_true' ,
1918- help = "Only sync files that are included in the Perforce Client Spec" )
1918+ help = "Only sync files that are included in the Perforce Client Spec" ),
1919+ optparse .make_option ("-/" , dest = "cloneExclude" ,
1920+ action = "append" , type = "string" ,
1921+ help = "exclude depot path" ),
19191922 ]
19201923 self .description = """Imports from Perforce into a git repository.\n
19211924 example:
@@ -1950,6 +1953,12 @@ def __init__(self):
19501953 if gitConfig ("git-p4.syncFromOrigin" ) == "false" :
19511954 self .syncWithOrigin = False
19521955
1956+ # This is required for the "append" cloneExclude action
1957+ def ensure_value (self , attr , value ):
1958+ if not hasattr (self , attr ) or getattr (self , attr ) is None :
1959+ setattr (self , attr , value )
1960+ return getattr (self , attr )
1961+
19531962 # Force a checkpoint in fast-import and wait for it to finish
19541963 def checkpoint (self ):
19551964 self .gitStream .write ("checkpoint\n \n " )
@@ -3101,22 +3110,13 @@ def __init__(self):
31013110 optparse .make_option ("--destination" , dest = "cloneDestination" ,
31023111 action = 'store' , default = None ,
31033112 help = "where to leave result of the clone" ),
3104- optparse .make_option ("-/" , dest = "cloneExclude" ,
3105- action = "append" , type = "string" ,
3106- help = "exclude depot path" ),
31073113 optparse .make_option ("--bare" , dest = "cloneBare" ,
31083114 action = "store_true" , default = False ),
31093115 ]
31103116 self .cloneDestination = None
31113117 self .needsGit = False
31123118 self .cloneBare = False
31133119
3114- # This is required for the "append" cloneExclude action
3115- def ensure_value (self , attr , value ):
3116- if not hasattr (self , attr ) or getattr (self , attr ) is None :
3117- setattr (self , attr , value )
3118- return getattr (self , attr )
3119-
31203120 def defaultDestination (self , args ):
31213121 ## TODO: use common prefix of args?
31223122 depotPath = args [0 ]
0 commit comments