optparse.make_option("--update-shelve", dest="update_shelve", action="append", type="int",
metavar="CHANGELIST",
help="update an existing shelved changelist, implies --shelve, "
- "repeat in-order for multiple shelved changelists")
+ "repeat in-order for multiple shelved changelists"),
+ optparse.make_option("--commit", dest="commit", metavar="COMMIT",
+ help="submit only the specified commit(s), one commit or xxx..xxx"),
+ optparse.make_option("--disable-rebase", dest="disable_rebase", action="store_true",
+ help="Disable rebase after submit is completed. Can be useful if you "
+ "work from a local git branch that is not master")
]
self.description = "Submit changes from git to the perforce depot."
self.usage += " [name of git branch to submit into perforce depot]"
self.dry_run = False
self.shelve = False
self.update_shelve = list()
+ self.commit = ""
+ self.disable_rebase = False
self.prepare_p4_only = False
self.conflict_behavior = None
self.isWindows = (platform.system() == "Windows")
else:
commitish = 'HEAD'
- for line in read_pipe_lines(["git", "rev-list", "--no-merges", "%s..%s" % (self.origin, commitish)]):
- commits.append(line.strip())
- commits.reverse()
+ if self.commit != "":
+ if self.commit.find("..") != -1:
+ limits_ish = self.commit.split("..")
+ for line in read_pipe_lines(["git", "rev-list", "--no-merges", "%s..%s" % (limits_ish[0], limits_ish[1])]):
+ commits.append(line.strip())
+ commits.reverse()
+ else:
+ commits.append(self.commit)
+ else:
+ for line in read_pipe_lines(["git", "rev-list", "--no-merges", "%s..%s" % (self.origin, commitish)]):
+ commits.append(line.strip())
+ commits.reverse()
if self.preserveUser or gitConfigBool("git-p4.skipUserNameCheck"):
self.checkAuthorship = False
sync.branch = self.branch
sync.run([])
- rebase = P4Rebase()
- rebase.rebase()
+ if self.disable_rebase is False:
+ rebase = P4Rebase()
+ rebase.rebase()
else:
if len(applied) == 0: