Re: State of Perforce importing.
- From
- Dmitry Kakurin <dmitry.kakurin@gmail.com>
- Date
- Sep 20, 2007, 06:12 UTC
- Message-ID
- <5BC36977390A4E61B826613630DF0BBC@ntdev.corp.microsoft.com>
- In-Reply-To
- <20070918154918.GA19106@old.davidb.org>
I had to import quite a big Perforce depot too. And after some struggle it went fine. For case mismatch: http://kb.perforce.com/AdminTasks/SuperuserTasks/CrossPlatfor..erMigration, bullet 10. It requires server access. For a@b and for excluding one p4 path during migration you could use my quick-and-dirty fix (attached). You can easily extend it to include and exclude multiple paths. Then it becomes as flexible as p4 client mapping.
- Dmitry ----- Original Message ----- From: "David Brown" <git@davidb.org> Newsgroups: gmane.comp.version-control.git To: "Sam Vilain" <sam@vilain.net> Cc: "Git" <git@vger.kernel.org> Sent: Tuesday, 18 September 2007 8:49 Subject: Re: State of Perforce importing.
Show 50 quoted lines
> On Tue, Sep 18, 2007 at 07:27:13PM +1200, Sam Vilain wrote: > >>I'm pretty close to giving a newer one a spin, that actually imports >>from the raw perforce back-end files without needing the perforce >>server. I am hoping that this should give a very clean import and will >>be very fast and efficient, sending files that share ancestry to gfi in >>sequence so that the on-the-fly delta system works. > > Unfortunately, this isn't something I'm going to be able to use. The > Perforce server will remain live, and resides on a machine I don't have > access to. > >>It could possibly be adapted to use the p4 client (though I'd expect >>that to be relatively slow per-revision), and possibly be extended to be >>bidirectional as all of the upstream change number information is >>recorded, a la git-svn. > > I was able to get 'git-p4' to work a lot better by using @all, but it > still > has some problems, at least bad interactions with P4. > > - It doesn't use any client spec. Our P4 server space is a complete > mismash and has to be fixed up to get a sane directory layout. For > example, some revisions have hundred-MB tar files sitting in the root > directory and I don't want that in the repo. I also need to exclude > directories, and in some cases completely rearrange the directory > layout. > > - Our P4 server is set to be case insensitive. 'git-p4' ignores paths > that come back from the server that are specified using a different > case. Unfortunately, this means that a handful of files just get > randomly dropped from each revision. > > I tried importing a client path instead of a depot path, but the names > that come back from 'p4 files' are depot based so none ever match. I > end up with a nice revision history of entirely empty trees. > > I'm probably going to end up writing an importer that uses an actual > client > workspace to let Perforce do the client mapping. I'm also going to have > to > put some work into some code to clean up the log messages, since most of > our changes have as a first line "New Features:", which makes for a rather > uninformative shortlog. > > But, I did learn about 'p4 -G' from git-p4 so that will help in getting > information from the repository. > > Thanks, > David
>From a089b02239c3bc310956964d61075b093d26549f Mon Sep 17 00:00:00 2001
From: Dmitry Kakurin <Dmitry.Kakurin@gmail.com> Date: Sun, 9 Sep 2007 13:58:12 -0700 Subject: [PATCH] git-p4: Added --exclude option and use P4 client name in commits
--- contrib/fast-import/git-p4 | 19 +++++++++++++++---- 1 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4 index adaaae6..337854f 100755 --- a/contrib/fast-import/git-p4 +++ b/contrib/fast-import/git-p4 @@ -769,6 +769,7 @@ class P4Sync(Command): self.keepRepoPath = False self.depotPaths = None self.p4BranchesInGit = [] + self.cloneExclude = None if gitConfig("git-p4.syncFromOrigin") == "false": self.syncWithOrigin = False @@ -779,8 +780,12 @@ class P4Sync(Command): while commit.has_key("depotFile%s" % fnum): path = commit["depotFile%s" % fnum] - found = [p for p in self.depotPaths - if path.startswith (p)] + if self.cloneExclude and path.startswith( self.cloneExclude ): + found = False + else: + found = [p for p in self.depotPaths + if path.startswith (p)] + if not found: fnum = fnum + 1 continue @@ -905,6 +910,8 @@ class P4Sync(Command): else: committer = "%s <a@b> %s %s" % (author, epoch, self.tz) + committer = "%s <%s@%s> %s %s" % (author, details["user"], details["client"], epoch, self.tz) + self.gitStream.write("committer %s\n" % committer) self.gitStream.write("data <<EOT\n") @@ -1540,10 +1547,14 @@ class P4Clone(P4Sync): P4Sync.__init__(self) self.description = "Creates a new git repository and imports from Perforce into it" self.usage = "usage: %prog [options] //depot/path[@revRange]" - self.options.append( + self.options += [ optparse.make_option("--destination", dest="cloneDestination", action='store', default=None, - help="where to leave result of the clone")) + help="where to leave result of the clone"), + optparse.make_option("--exclude", dest="cloneExclude", + action='store', default=None, + help="exclude depot path") + ] self.cloneDestination = None self.needsGit = False
-- 1.5.3.mingw.1.1.g01e3a1