1352
optparse.make_option("--update-shelve", dest="update_shelve", action="append", type="int",
1353
metavar="CHANGELIST",
1354
help="update an existing shelved changelist, implies --shelve, "
1355
- "repeat in-order for multiple shelved changelists")
1355
+ "repeat in-order for multiple shelved changelists"),
1356
+ optparse.make_option("--commit", dest="commit", metavar="COMMIT",
1357
+ help="submit only the specified commit(s), one commit or xxx..xxx"),
1358
+ optparse.make_option("--disable-rebase", dest="disable_rebase", action="store_true",
1359
+ help="Disable rebase after submit is completed. Can be useful if you "
1360
+ "work from a local git branch that is not master")
1361
]
1362
self.description = "Submit changes from git to the perforce depot."
1363
self.usage += " [name of git branch to submit into perforce depot]"
1367
self.dry_run = False
1368
self.shelve = False
1369
self.update_shelve = list()
1370
+ self.commit = ""
1371
+ self.disable_rebase = False
1372
self.prepare_p4_only = False
1373
self.conflict_behavior = None
1374
self.isWindows = (platform.system() == "Windows")
2110
else:
2111
commitish = 'HEAD'
2112
2106
- for line in read_pipe_lines(["git", "rev-list", "--no-merges", "%s..%s" % (self.origin, commitish)]):
2107
- commits.append(line.strip())
2108
- commits.reverse()
2113
+ if self.commit != "":
2114
+ if self.commit.find("..") != -1:
2115
+ limits_ish = self.commit.split("..")
2116
+ for line in read_pipe_lines(["git", "rev-list", "--no-merges", "%s..%s" % (limits_ish[0], limits_ish[1])]):
2117
+ commits.append(line.strip())
2118
+ commits.reverse()
2119
+ else:
2120
+ commits.append(self.commit)
2121
+ else:
2122
+ for line in read_pipe_lines(["git", "rev-list", "--no-merges", "%s..%s" % (self.origin, commitish)]):
2123
+ commits.append(line.strip())
2124
+ commits.reverse()
2125
2126
if self.preserveUser or gitConfigBool("git-p4.skipUserNameCheck"):
2127
self.checkAuthorship = False
2231
sync.branch = self.branch
2232
sync.run([])
2233
2218
- rebase = P4Rebase()
2219
- rebase.rebase()
2234
+ if self.disable_rebase is False:
2235
+ rebase = P4Rebase()
2236
+ rebase.rebase()
2237
2238
else:
2239
if len(applied) == 0: