{"thread":{"id":"61905","subject":"Added support for --branch to git p4 rebase in git-p4.py","startedAt":"2024-08-05T22:49:37Z","lastAt":"2024-08-05T22:49:37Z","messageCount":1,"participants":["Samuel Hishmeh"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"500126","messageId":"CAGdcVNMPA6u+OiHYWfZvDxHef767Sa_oyK6+v7VjSUt1rNmbMQ@mail.gmail.com","threadId":"61905","inReplyTo":null,"subject":"Added support for --branch to git p4 rebase in git-p4.py","fromName":"Samuel Hishmeh","fromEmail":"samuel.hishmeh@gmail.com","sentAt":"2024-08-05T22:49:25Z","receivedAt":"2024-08-05T22:49:37Z","isPatch":false,"sender":{"key":"samuel.hishmeh@gmail.com","avatar":null},"body":"I added support for the --branch option to the git p4 rebase command in\ngit-p4.py. Here's the commit:\n\nhttps://github.com/git/git/commit/27b68a48969ee9be091abfd971e0c0aa092b1638\n\nHere's the pull request:\n\nhttps://github.com/git/git/pull/1759\n\nHere's the patch:\n\nFrom 27b68a48969ee9be091abfd971e0c0aa092b1638 Mon Sep 17 00:00:00 2001\nFrom: Samuel <67290240+shish456@users.noreply.github.com>\nDate: Mon, 5 Aug 2024 16:48:55 -0500\nSubject: [PATCH] Added support for --branch to git p4 rebase in git-p4.py\n\ngit p4 can be made to support branches as streams to an extent\n(https://stackoverflow.com/questions/15305357/how-to-clone-branch-with-git-p4).\nUnfortunately the git p4 rebase command uses the git p4 sync command,\nbut it doesn't support any of the git p4 sync options. I added the\n--branch option to git p4 rebase so that it can be used with multiple\nbranches.\n---\n git-p4.py | 3 +++\n 1 file changed, 3 insertions(+)\n\ndiff --git a/git-p4.py b/git-p4.py\nindex f1ab31d54036be..17a83e8dc07b4b 100755\n--- a/git-p4.py\n+++ b/git-p4.py\n@@ -4270,14 +4270,17 @@ class P4Rebase(Command):\n     def __init__(self):\n         Command.__init__(self)\n         self.options = [\n+                optparse.make_option(\"--branch\", dest=\"branch\"),\n                 optparse.make_option(\"--import-labels\",\ndest=\"importLabels\", action=\"store_true\"),\n         ]\n+        self.branch = \"\"\n         self.importLabels = False\n         self.description = (\"Fetches the latest revision from perforce and \"\n                             + \"rebases the current work (branch) against it\")\n\n     def run(self, args):\n         sync = P4Sync()\n+        sync.branch = self.branch\n         sync.importLabels = self.importLabels\n         sync.run([])\n"}]}