@matheusbsbs / matheus-bagliano / commits / c6d44cb1a1
Fork 0

Changed the default p4 import branch to be refs/remotes/p4/{HEAD,master} instead of refs/heads/p4.

Changed the default p4 import branch to be refs/remotes/p4/{HEAD,master} instead of refs/heads/p4. Signed-off-by: Simon Hausmann <simon@lst.de>

Simon Hausmann committed May 17, 2007 at 20:57 UTC c6d44cb1a1a9bca58d91ef414b9dbaa393d2de3a
2 files changed +12 -4
contrib/fast-import/git-p4
+9 -1
@@ -828,9 +828,15 @@ class P4Sync(Command):
828 self.changeRange = ""
829 self.initialParent = ""
830 self.previousDepotPath = ""
831 + # importing into default remotes/p4/* layout?
832 + defaultImport = False
833
834 if len(self.branch) == 0:
833 - self.branch = "p4"
835 + if gitBranchExists("refs/heads/p4"):
836 + self.branch = "p4"
837 + else:
838 + self.branch = "refs/remotes/p4/master"
839 + defaultImport = True
840
841 if len(args) == 0:
842 if not gitBranchExists(self.branch) and gitBranchExists("origin"):
@@ -840,6 +846,8 @@ class P4Sync(Command):
846 if not branch.startswith("refs"):
847 branch = "refs/heads/" + branch
848 system("git update-ref %s origin" % branch)
849 + if defaultImport:
850 + system("git symbolic-ref refs/remotes/p4/HEAD %s" % branch)
851
852 [self.previousDepotPath, p4Change] = extractDepotPathAndChangeFromGitLog(extractLogMessageFromGitCommit(self.branch))
853 if len(self.previousDepotPath) > 0 and len(p4Change) > 0:
contrib/fast-import/git-p4.txt
+3 -3
@@ -20,9 +20,9 @@ or
20
21 This will create an empty git repository in a subdirectory called "project" (or
22 "myproject" with the second command), import the head revision from the
23 -specified perforce path into a git "p4" branch, create a master branch off it
24 -and check it out. If you want the entire history (not just the head revision) then
25 -you can simply append a "@all" to the depot path:
23 +specified perforce path into a git "p4" branch (remotes/p4 actually), create a
24 +master branch off it and check it out. If you want the entire history (not just
25 +the head revision) then you can simply append a "@all" to the depot path:
26
27 git-p4 clone //depot/project/main@all myproject
28