parameters: (self, gitdiff)
return_statement: return "".join(svndiff)
docstring: Converts the diff output to include an svn-style "Index:" line as well
      as record the hashes of the files, so we can upload them along with our
      diff.
docstring_summary: Converts the diff output to include an svn-style "Index:" line as well
      as record the hashes of the files, so we can upload them along with our
      diff.
docstring_tokens: Converts the diff output to include an svn - style Index : line as well as record the hashes of the files so we can upload them along with our diff .
function: def PostProcessDiff(self, gitdiff):
      """Converts the diff output to include an svn-style "Index:" line as well
      as record the hashes of the files, so we can upload them along with our
      diff."""
      # Special used by git to indicate "no such content".
      NULL_HASH = "0"*40
  
      def IsFileNew(filename):
        return filename in self.hashes and self.hashes[filename][0] is None
  
      def AddSubversionPropertyChange(filename):
        """Add svn's property change information into the patch if given file is
        new file.
  
        We use Subversion's auto-props setting to retrieve its property.
        See http://svnbook.red-bean.com/en/1.1/ch07.html#svn-ch-7-sect-1.3.2 for
        Subversion's [auto-props] setting.
        """
        if self.options.emulate_svn_auto_props and IsFileNew(filename):
          svnprops = GetSubversionPropertyChanges(filename)
          if svnprops:
            svndiff.append("\n" + svnprops + "\n")
  
      svndiff = []
      filecount = 0
      filename = None
      for line in gitdiff.splitlines():
        match = re.match(r"diff --git a/(.*) b/(.*)$", line)
        if match:
          # Add auto property here for previously seen file.
          if filename is not None:
            AddSubversionPropertyChange(filename)
          filecount += 1
          # Intentionally use the "after" filename so we can show renames.
          filename = match.group(2)
          svndiff.append("Index: %s\n" % filename)
          if match.group(1) != match.group(2):
            self.renames[match.group(2)] = match.group(1)
        else:
          # The "index" line in a git diff looks like this (long hashes elided):
          #   index 82c0d44..b2cee3f 100755
          # We want to save the left hash, as that identifies the base file.
          match = re.match(r"index (\w+)\.\.(\w+)", line)
          if match:
            before, after = (match.group(1), match.group(2))
            if before == NULL_HASH:
              before = None
            if after == NULL_HASH:
              after = None
            self.hashes[filename] = (before, after)
        svndiff.append(line + "\n")
      if not filecount:
        ErrorExit("No valid patches found in output from git diff")
      # Add auto property for the last seen file.
      assert filename is not None
      AddSubversionPropertyChange(filename)
      return "".join(svndiff)
function_tokens: def PostProcessDiff ( self , gitdiff ) : # Special used by git to indicate "no such content". NULL_HASH = "0" * 40 def IsFileNew ( filename ) : return filename in self . hashes and self . hashes [ filename ] [ 0 ] is None def AddSubversionPropertyChange ( filename ) : """Add svn's property change information into the patch if given file is
        new file.
  
        We use Subversion's auto-props setting to retrieve its property.
        See http://svnbook.red-bean.com/en/1.1/ch07.html#svn-ch-7-sect-1.3.2 for
        Subversion's [auto-props] setting.
        """ if self . options . emulate_svn_auto_props and IsFileNew ( filename ) : svnprops = GetSubversionPropertyChanges ( filename ) if svnprops : svndiff . append ( "\n" + svnprops + "\n" ) svndiff = [ ] filecount = 0 filename = None for line in gitdiff . splitlines ( ) : match = re . match ( r"diff --git a/(.*) b/(.*)$" , line ) if match : # Add auto property here for previously seen file. if filename is not None : AddSubversionPropertyChange ( filename ) filecount += 1 # Intentionally use the "after" filename so we can show renames. filename = match . group ( 2 ) svndiff . append ( "Index: %s\n" % filename ) if match . group ( 1 ) != match . group ( 2 ) : self . renames [ match . group ( 2 ) ] = match . group ( 1 ) else : # The "index" line in a git diff looks like this (long hashes elided): #   index 82c0d44..b2cee3f 100755 # We want to save the left hash, as that identifies the base file. match = re . match ( r"index (\w+)\.\.(\w+)" , line ) if match : before , after = ( match . group ( 1 ) , match . group ( 2 ) ) if before == NULL_HASH : before = None if after == NULL_HASH : after = None self . hashes [ filename ] = ( before , after ) svndiff . append ( line + "\n" ) if not filecount : ErrorExit ( "No valid patches found in output from git diff" ) # Add auto property for the last seen file. assert filename is not None AddSubversionPropertyChange ( filename ) return "" . join ( svndiff )