git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
SHSamuel Hishmeh <samuel.hishmeh@gmail.com>
Date
Aug 5, 2024, 22:49 UTC
Message-ID
<CAGdcVNMPA6u+OiHYWfZvDxHef767Sa_oyK6+v7VjSUt1rNmbMQ@mail.gmail.com>

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 --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([])
Message 1 of 1 in “Added support for --branch to git p4 rebase in git-p4.py”
  1. Samuel HishmehAug 5, 2024

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.