@@ -1202,6 +1202,9 @@ def applyCommit(self, id):
1202
1202
p4_revert (f )
1203
1203
return False
1204
1204
1205
+ #
1206
+ # Apply the patch for real, and do add/delete/+x handling.
1207
+ #
1205
1208
system (applyPatchCmd )
1206
1209
1207
1210
for f in filesToAdd :
@@ -1215,6 +1218,10 @@ def applyCommit(self, id):
1215
1218
mode = filesToChangeExecBit [f ]
1216
1219
setP4ExecBit (f , mode )
1217
1220
1221
+ #
1222
+ # Build p4 change description, starting with the contents
1223
+ # of the git commit message.
1224
+ #
1218
1225
logMessage = extractLogMessageFromGitCommit (id )
1219
1226
logMessage = logMessage .strip ()
1220
1227
(logMessage , jobs ) = self .separate_jobs_from_description (logMessage )
@@ -1223,15 +1230,24 @@ def applyCommit(self, id):
1223
1230
submitTemplate = self .prepareLogMessage (template , logMessage , jobs )
1224
1231
1225
1232
if self .preserveUser :
1226
- submitTemplate = submitTemplate + ("\n ######## Actual user %s, modified after commit\n " % p4User )
1233
+ submitTemplate += "\n ######## Actual user %s, modified after commit\n " % p4User
1234
+
1235
+ if self .checkAuthorship and not self .p4UserIsMe (p4User ):
1236
+ submitTemplate += "######## git author %s does not match your p4 account.\n " % gitEmail
1237
+ submitTemplate += "######## Use option --preserve-user to modify authorship.\n "
1238
+ submitTemplate += "######## Variable git-p4.skipUserNameCheck hides this message.\n "
1239
+
1240
+ separatorLine = "######## everything below this line is just the diff #######\n "
1227
1241
1242
+ # diff
1228
1243
if os .environ .has_key ("P4DIFF" ):
1229
1244
del (os .environ ["P4DIFF" ])
1230
1245
diff = ""
1231
1246
for editedFile in editedFiles :
1232
1247
diff += p4_read_pipe (['diff' , '-du' ,
1233
1248
wildcard_encode (editedFile )])
1234
1249
1250
+ # new file diff
1235
1251
newdiff = ""
1236
1252
for newFile in filesToAdd :
1237
1253
newdiff += "==== new file ====\n "
@@ -1242,13 +1258,7 @@ def applyCommit(self, id):
1242
1258
newdiff += "+" + line
1243
1259
f .close ()
1244
1260
1245
- if self .checkAuthorship and not self .p4UserIsMe (p4User ):
1246
- submitTemplate += "######## git author %s does not match your p4 account.\n " % gitEmail
1247
- submitTemplate += "######## Use option --preserve-user to modify authorship.\n "
1248
- submitTemplate += "######## Variable git-p4.skipUserNameCheck hides this message.\n "
1249
-
1250
- separatorLine = "######## everything below this line is just the diff #######\n "
1251
-
1261
+ # change description file: submitTemplate, separatorLine, diff, newdiff
1252
1262
(handle , fileName ) = tempfile .mkstemp ()
1253
1263
tmpFile = os .fdopen (handle , "w+" )
1254
1264
if self .isWindows :
@@ -1258,6 +1268,9 @@ def applyCommit(self, id):
1258
1268
tmpFile .write (submitTemplate + separatorLine + diff + newdiff )
1259
1269
tmpFile .close ()
1260
1270
1271
+ #
1272
+ # Let the user edit the change description, then submit it.
1273
+ #
1261
1274
if self .edit_template (fileName ):
1262
1275
# read the edited message and submit
1263
1276
ret = True
0 commit comments