(self, editedFiles, filesToAdd, symlinks)
| 2113 | return False |
| 2114 | |
| 2115 | def get_diff_description(self, editedFiles, filesToAdd, symlinks): |
| 2116 | # diff |
| 2117 | if "P4DIFF" in os.environ: |
| 2118 | del(os.environ["P4DIFF"]) |
| 2119 | diff = "" |
| 2120 | for editedFile in editedFiles: |
| 2121 | diff += p4_read_pipe(['diff', '-du', |
| 2122 | wildcard_encode(editedFile)]) |
| 2123 | |
| 2124 | # new file diff |
| 2125 | newdiff = "" |
| 2126 | for newFile in filesToAdd: |
| 2127 | newdiff += "==== new file ====\n" |
| 2128 | newdiff += "--- /dev/null\n" |
| 2129 | newdiff += "+++ %s\n" % newFile |
| 2130 | |
| 2131 | is_link = os.path.islink(newFile) |
| 2132 | expect_link = newFile in symlinks |
| 2133 | |
| 2134 | if is_link and expect_link: |
| 2135 | newdiff += "+%s\n" % os.readlink(newFile) |
| 2136 | else: |
| 2137 | f = open(newFile, "r") |
| 2138 | try: |
| 2139 | for line in f.readlines(): |
| 2140 | newdiff += "+" + line |
| 2141 | except UnicodeDecodeError: |
| 2142 | # Found non-text data and skip, since diff description |
| 2143 | # should only include text |
| 2144 | pass |
| 2145 | f.close() |
| 2146 | |
| 2147 | return (diff + newdiff).replace('\r\n', '\n') |
| 2148 | |
| 2149 | def applyCommit(self, id): |
| 2150 | """Apply one commit, return True if it succeeded.""" |
no test coverage detected