scripts/svn_helper.py
changeset 52 25d8f4623447
parent 44 9d3a0f98df34
child 63 9b1909e46633
equal deleted inserted replaced
51:9f288fee8a82 52:25d8f4623447
    44 #: actual file and directory node_kinds (includes dir and file, but excludes
    44 #: actual file and directory node_kinds (includes dir and file, but excludes
    45 #: the "non-file" none and unknown)
    45 #: the "non-file" none and unknown)
    46 PYSVN_FILE_DIR_NODE_KINDS = set([pysvn.node_kind.dir, pysvn.node_kind.file])
    46 PYSVN_FILE_DIR_NODE_KINDS = set([pysvn.node_kind.dir, pysvn.node_kind.file])
    47 
    47 
    48 
    48 
       
    49 # pysvn Client object initialized lazily the first time getPySvnClient()
       
    50 # is called.
    49 _client = None
    51 _client = None
    50 
    52 
    51 
    53 
    52 def getPySvnClient():
    54 def getPySvnClient():
    53   """Returns the module-global pysvn Client object (creating one if needed).
    55   """Returns the module-global pysvn Client object (creating one if needed).
       
    56 
       
    57   Lazily initializes a global pysvn Client object, returning the same one
       
    58   once it exists.
    54   """
    59   """
    55   global _client
    60   global _client
    56 
    61 
    57   if not _client:
    62   if not _client:
    58     _client = pysvn.Client()
    63     _client = pysvn.Client()
    93   return path
    98   return path
    94 
    99 
    95 
   100 
    96 def useLocalOsSep(path):
   101 def useLocalOsSep(path):
    97   """Return path with all / characters replaced with os.sep, to be OS-agnostic.
   102   """Return path with all / characters replaced with os.sep, to be OS-agnostic.
       
   103 
       
   104   Args:
       
   105     path: an SVN path (either working copy path or relative path, but not a
       
   106       full repository URL) that uses the canonical / separators
    98   """
   107   """
    99   return path.replace('/', os.sep)
   108   return path.replace('/', os.sep)
   100 
   109 
   101 
   110 
   102 def getExpandedWorkingCopyPath(path, wc_root=None):
   111 def getExpandedWorkingCopyPath(path, wc_root=None):