diff mbox series

Added support for --branch to git p4 rebase in git-p4.py

Message ID CAGdcVNMPA6u+OiHYWfZvDxHef767Sa_oyK6+v7VjSUt1rNmbMQ@mail.gmail.com (mailing list archive)
State New
Headers show
Series Added support for --branch to git p4 rebase in git-p4.py | expand

Commit Message

Samuel Hishmeh Aug. 5, 2024, 10:49 p.m. UTC
I added support for the --branch option to the git p4 rebase command in
git-p4.py. Here's the commit:

https://github.com/git/git/commit/27b68a48969ee9be091abfd971e0c0aa092b1638

Here's the pull request:

https://github.com/git/git/pull/1759

Here's the patch:

From 27b68a48969ee9be091abfd971e0c0aa092b1638 Mon Sep 17 00:00:00 2001
From: Samuel <67290240+shish456@users.noreply.github.com>
Date: Mon, 5 Aug 2024 16:48:55 -0500
Subject: [PATCH] Added support for --branch to git p4 rebase in git-p4.py

git p4 can be made to support branches as streams to an extent
(https://stackoverflow.com/questions/15305357/how-to-clone-branch-with-git-p4).
Unfortunately the git p4 rebase command uses the git p4 sync command,
but it doesn't support any of the git p4 sync options. I added the
--branch option to git p4 rebase so that it can be used with multiple
branches.
---
 git-p4.py | 3 +++
 1 file changed, 3 insertions(+)
diff mbox series

Patch

diff --git a/git-p4.py b/git-p4.py
index f1ab31d54036be..17a83e8dc07b4b 100755
--- a/git-p4.py
+++ b/git-p4.py
@@ -4270,14 +4270,17 @@  class P4Rebase(Command):
     def __init__(self):
         Command.__init__(self)
         self.options = [
+                optparse.make_option("--branch", dest="branch"),
                 optparse.make_option("--import-labels",
dest="importLabels", action="store_true"),
         ]
+        self.branch = ""
         self.importLabels = False
         self.description = ("Fetches the latest revision from perforce and "
                             + "rebases the current work (branch) against it")

     def run(self, args):
         sync = P4Sync()
+        sync.branch = self.branch
         sync.importLabels = self.importLabels
         sync.run([])