MCPcopy Index your code
hub / github.com/git/git / patchRCSKeywords

Method patchRCSKeywords

git-p4.py:1906–1924  ·  view source on GitHub ↗

Attempt to zap the RCS keywords in a p4 controlled file matching the given regex.

(self, file, regexp)

Source from the content-addressed store, hash-verified

1904 return result
1905
1906 def patchRCSKeywords(self, file, regexp):
1907 """Attempt to zap the RCS keywords in a p4 controlled file matching the
1908 given regex.
1909 """
1910 handle, outFileName = tempfile.mkstemp(dir='.')
1911 try:
1912 with os.fdopen(handle, "wb") as outFile, open(file, "rb") as inFile:
1913 for line in inFile.readlines():
1914 outFile.write(regexp.sub(br'$\1$', line))
1915 # Forcibly overwrite the original file
1916 os.unlink(file)
1917 shutil.move(outFileName, file)
1918 except:
1919 # cleanup our temporary file
1920 os.unlink(outFileName)
1921 print("Failed to strip RCS keywords in %s" % file)
1922 raise
1923
1924 print("Patched up RCS keywords in %s" % file)
1925
1926 def p4UserForCommit(self, id):
1927 """Return the tuple (perforce user,git email) for a given git commit

Callers 1

applyCommitMethod · 0.95

Calls 1

writeMethod · 0.45

Tested by

no test coverage detected