summaryrefslogtreecommitdiff
path: root/contrib/fast-import
AgeCommit message (Collapse)AuthorFilesLines
2008-03-28git-p4: Handle Windows EOLs properly after removal of p4 submit template ↵Libravatar Marius Storm-Olsen1-13/+15
handling. git-p4s handling of Windows style EOL was broken after the removal of the p4 submit template handling in commit f2a6059. Fix that, and make getP4OpenedType() more robust. Signed-off-by: Marius Storm-Olsen <marius@trolltech.com> Signed-off-by: Simon Hausmann <simon@lst.de>
2008-03-13git-p4: Use P4EDITOR environment variable when setLibravatar Shawn Bohrer1-1/+4
Perforce allows you to set the P4EDITOR environment variable to your preferred editor for use in perforce. Since we are displaying a perforce changelog to the user we should use it when it is defined. Signed-off-by: Shawn Bohrer <shawn.bohrer@gmail.com> Signed-off-by: Simon Hausmann <simon@lst.de>
2008-03-13git-p4: Unset P4DIFF environment variable when using 'p4 -du diff'Libravatar Shawn Bohrer1-0/+2
A custom diffing utility can be specified for the 'p4 diff' command by setting the P4DIFF environment variable. However when using a custom diffing utility such as 'vimdiff' passing options like -du can cause unexpected behavior. Since the goal is to generate a unified diff of the changes and attach them to the bottom of the p4 submit log we should unset P4DIFF if it has been set in order to generate the diff properly. Signed-off-by: Shawn Bohrer <shawn.bohrer@gmail.com> Signed-off-by: Simon Hausmann <simon@lst.de>
2008-03-13git-p4: Optimize the fetching of data from perforce.Libravatar Marius Storm-Olsen1-8/+8
Use shallow copies in loop, and join content at the end. Then do the substitution, if needed. Signed-off-by: Marius Storm-Olsen <marius@trolltech.com> Signed-off-by: Simon Hausmann <simon@lst.de>
2008-03-03git-p4: Fix import of changesets with file deletionsLibravatar Simon Hausmann1-20/+25
Commit 3a70cdfa42199e16d2d047c286431c4274d65b1a made readP4Files abort quickly when the changeset only contains files that are marked for deletion with an empty return value, which caused the commit to not do anything. This commit changes readP4Files to distinguish between files that need to be passed to p4 print and files that have no content ("deleted") and merge them in the returned list. Signed-off-by: Simon Hausmann <simon@lst.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-27git-p4: Support usage of perforce client specLibravatar Tor Arvid Lund1-8/+42
When syncing, git-p4 will only download files that are included in the active perforce client spec. This does not change the default behaviour - it requires that the user either supplies the command line argument --use-client-spec, or sets the git config option p4.useclientspec to "true". Signed-off-by: Tor Arvid Lund <torarvid@gmail.com> Signed-off-by: Simon Hausmann <simon@lst.de>
2008-02-27git-p4: git-p4 submit cleanups.Libravatar Simon Hausmann1-41/+10
Removed storing the list of commits in a configuration file. We only need the list of commits at run-time. Signed-off-by: Simon Hausmann <simon@lst.de>
2008-02-27git-p4: Removed git-p4 submit --direct.Libravatar Simon Hausmann1-45/+11
This feature was originally meant to allow for quicker direct submits into perforce, but it turns out that it is not actually quicker than doing a git commit and then running git-p4 submit. Signed-off-by: Simon Hausmann <simon@lst.de>
2008-02-27git-p4: Clean up git-p4 submit's log message handling.Libravatar Simon Hausmann1-16/+16
Instead of trying to substitute fields in the p4 submit template we now simply replace the description of the submit with the log message of the git commit. Signed-off-by: Simon Hausmann <simon@lst.de>
2008-02-27git-p4: Remove --log-substitutions feature.Libravatar Simon Hausmann1-7/+0
This turns out to be rarely useful and is already covered by git's commit.template configuration variable. Signed-off-by: Simon Hausmann <simon@lst.de>
2008-02-27git-p4: support exclude pathsLibravatar Tommy Thorn1-4/+22
Teach git-p4 about the -/ option which adds depot paths to the exclude list, used when cloning. The option is chosen such that the natural Perforce syntax works, eg: git p4 clone //branch/path/... -//branch/path/{large,old}/... Trailing ... on exclude paths are optional. This is a generalization of a change by Dmitry Kakurin (thanks). Signed-off-by: Tommy Thorn <tommy-git@thorn.ws> Signed-off-by: Simon Hausmann <simon@lst.de>
2008-02-07git-p4: Fix indentation from tab to spacesLibravatar Toby Allsopp1-1/+1
Signed-off-by: Toby Allsopp <toby.allsopp@navman.co.nz>
2008-02-03git-p4: Fix an obvious typoLibravatar Tommy Thorn1-1/+1
The regexp "$," can't match anything. Clearly not intended. This was introduced in ce6f33c8 which is quite a while ago. Signed-off-by: Tommy Thorn <tommy-git@thorn.ws> Acked-by: Simon Hausmann <simon@lst.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-03git-p4: Ensure the working directory and the index are clean before "git-p4 ↵Libravatar Simon Hausmann1-0/+5
rebase" Signed-off-by: Simon Hausmann <simon@lst.de>
2008-02-03git-p4: Fix submit user-interface.Libravatar Simon Hausmann1-59/+26
Don't ask any questions when submitting, behave similar to git-svn dcommit. Signed-off-by: Simon Hausmann <simon@lst.de>
2008-02-03Remove $Id: ..$ $Header: ..$ etc from +ko and +k files during importLibravatar Jason McMullan1-3/+7
This patch removes the '$Keyword: ...$' '...' data, so that files don't have spurious megre conflicts between branches. Handles both +ko and +k styles, and leaves the '$Foo$' in the original file. Signed-off-by: Simon Hausmann <simon@lst.de>
2007-11-20git-p4: Fix typo in --detect-labelsLibravatar Shun Kei Leung1-1/+1
Signed-off-by: Kevin Leung <kevinlsk@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-16git-p4: Fix direct import from perforce after fetching changes through git ↵Libravatar Simon Hausmann1-2/+13
from origin When using an existing git repository to cache the perforce import we don't fetch the branch mapping from perforce as that is a slow operation. However the origin repository may not be fully up-to-date and therefore it may be necessary to import more changes directly from Perforce. Such a direct import needs self.knownBranches to be set up though, so initialize it from the existing p4/* git branches. Signed-off-by: Simon Hausmann <simon@lst.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-02git-p4: Detect changes to executable bit and include them in p4 submit.Libravatar Chris Pettitt1-0/+44
This changeset takes advantage of the new parseDiffTreeEntry(...) function to detect changes to the execute bit in the git repository. During submit, git-p4 now looks for changes to the executable bit and if it finds them it "reopens" the file in perforce, which allows it to change the file type. The logic for adding the executable bit in perforce is straightforward: the +x modifier can be used. Removing the executable bit in perforce requires that the entire filetype be redefined (there is no way to join remove the bit with a -x modifier, for example). This changeset includes logic to remove the executable bit from the full file type while preserving the base file type and other modifiers. Signed-off-by: Chris Pettitt <cpettitt@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-02git-p4: Add a helper function to parse the full git diff-tree output.Libravatar Chris Pettitt1-4/+45
Signed-off-by: Chris Pettitt <cpettitt@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-10-20git-p4 support for perforce renames.Libravatar Chris Pettitt1-1/+11
The current git-p4 implementation does support file renames. However, because it does not use the "p4 integrate" command, the history for the renamed file is not linked to the new file. This changeset adds support for perforce renames with the integrate command. Currently this feature is only enabled when calling git-p4 submit with the -M option. This is intended to look and behave similar to the "detect renames" feature of other git commands. The following sequence is used for renamed files: p4 integrate -Dt x x' p4 edit x' rm x' git apply p4 delete x By default, perforce will not allow an integration with a target file that has been deleted. That is, if x' in the example above is the name of a previously deleted file then perforce will fail the integrate. The -Dt option tells perforce to allow the target of integrate to be a previously deleted file. Signed-off-by: Chris Pettitt <cpettitt@gmail.com> Signed-off-by: Simon Hausmann <simon@lst.de>
2007-10-20git-p4: When skipping a patch as part of "git-p4 submit" make sure we ↵Libravatar Simon Hausmann1-0/+4
correctly revert to the previous state of the files using "p4 revert". Signed-off-by: Simon Hausmann <simon@lst.de>
2007-10-15Add 'git-p4 commit' as an alias for 'git-p4 submit'Libravatar Marius Storm-Olsen1-0/+1
Given that git uses 'commit', git-p4's 'sumbit' was a bit confusing at times; often making me do 'git submit' and 'git-p4 commit' instead. Signed-off-by: Marius Storm-Olsen <marius@trolltech.com> Acked-By: Simon Hausmann <simon@lst.de> Signed-off-by: Lars Hjemli <hjemli@gmail.com> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-09-23Merge branch 'maint'Libravatar Junio C Hamano1-1/+9
* maint: git-svn: don't attempt to spawn pager if we don't want one Supplant the "while case ... break ;; esac" idiom User Manual: add a chapter for submodules user-manual: don't assume refs are stored under .git/refs Detect exec bit in more cases. Conjugate "search" correctly in the git-prune-packed man page. Move the paragraph specifying where the .idx and .pack files should be Documentation/git-lost-found.txt: drop unnecessarily duplicated name.
2007-09-22Detect exec bit in more cases.Libravatar David Brown1-1/+9
git-p4 was missing the execute bit setting if the file had other attribute bits set. Acked-By: Simon Hausmann <simon@lst.de>
2007-09-18contrib/fast-import: add perl version of simple exampleLibravatar Jeff King1-0/+64
This is based on the git-import.sh script, but is a little more robust and efficient. More importantly, it should serve as a quick template for interfacing fast-import with perl scripts. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-18contrib/fast-import: add simple shell exampleLibravatar Nguyen Thai Ngoc Duy1-0/+38
This example just puts a directory under git control. It is significantly slower than using the git tools directly, but hopefully shows a bit how fast-import works. [jk: added header comments] Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-09-03git-p4: Added support for automatically importing newly appearing perforce ↵Libravatar Simon Hausmann1-2/+74
branches. If a change in a p4 "branch" appears that hasn't seen any previous commit and that has a known branch mapping we now try to import it properly. First we find the p4 change of the source branch that the new p4 branch is based on. Then we using git rev-list --bisect to locate the corresponding git commit to that change. Finally we import all changes in the new p4 branch up to the current change and resume with the regular import. Signed-off-by: Simon Hausmann <simon@lst.de>
2007-09-03git-p4: Cleanup; moved the (duplicated) code for turning a branch into a git ↵Libravatar Simon Hausmann1-17/+11
ref (for example foo -> refs/remotes/p4/<project>/foo) into a separate method. Signed-off-by: Simon Hausmann <simon@lst.de>
2007-09-03git-p4: Cleanup; moved the code for the initial #head or revision import ↵Libravatar Simon Hausmann1-42/+45
into a separate function, out of P4Sync.run. Signed-off-by: Simon Hausmann <simon@lst.de>
2007-09-03git-p4: Cleanup; Turn self.revision into a function local variable (it's not ↵Libravatar Simon Hausmann1-9/+9
used anywhere outside the function). Signed-off-by: Simon Hausmann <simon@lst.de>
2007-09-03git-p4: Cleanup; moved the code to import a list of p4 changes using ↵Libravatar Simon Hausmann1-69/+71
fast-import into a separate member function of P4Sync. Signed-off-by: Simon Hausmann <simon@lst.de>
2007-09-03git-p4: Cleanup; moved the code for getting a sorted list of p4 changes for ↵Libravatar Simon Hausmann1-9/+14
a list of given depot paths into a standalone method. Signed-off-by: Simon Hausmann <simon@lst.de>
2007-09-03git-p4: After submission to p4 always synchronize from p4 again (into ↵Libravatar Simon Hausmann1-2/+9
refs/remotes). Whether to rebase HEAD or not is still left as question to the end-user. Signed-off-by: Simon Hausmann <simon@lst.de>
2007-09-03git-p4: Always call 'p4 sync ...' before submitting to Perforce.Libravatar Simon Hausmann1-3/+2
Acked-by: Marius Storm-Olsen <marius@trolltech.com> Acked-by: Thiago Macieira <thiago@kde.org>
2007-08-24git-p4: Fix warnings about non-existant refs/remotes/p4/HEAD ref when ↵Libravatar Simon Hausmann1-1/+1
running git-p4 sync the first time after a git clone. Don't create the p4/HEAD symbolic ref if p4/master doesn't exist yet. Signed-off-by: Simon Hausmann <simon@lst.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-08-24git-p4: Make 'git-p4 branches' work after an initial clone with git clone ↵Libravatar Simon Hausmann1-49/+55
from an origin-updated repository. After a clone with "git clone" of a repository the p4 branches are only in remotes/origin/p4/* and not in remotes/p4/*. Separate the code for detection and creation out of the P4Sync command class into standalone methods and use them from the P4Branches command. Signed-off-by: Simon Hausmann <simon@lst.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-08-13git-p4: Fix the sorting of changelists when cloning a Perforce repository.Libravatar Reece H. Dunn1-1/+1
When performing a git-p4 clone operation on a Perforce repository, where the changelists change in order of magnitude (e.g. 100 to 1000), the set of changes to import from is not sorted properly. This is because the data in the list is strings not integers. The other place where this is done already converts the value to an integer, so it is not affected. Acked-by: Simon Hausmann <simon@lst.de>
2007-08-08git-p4: Fix git-p4 submit to include only changed files in the perforce ↵Libravatar Simon Hausmann1-6/+30
submit template. Parse the files section in the "p4 change -o" output and remove lines with file changes in unrelated depot paths. Signed-off-by: Simon Hausmann <simon@lst.de> Signed-off-by: Marius Storm-Olsen <marius@trolltech.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-08-08git-p4: Fix support for symlinks.Libravatar Simon Hausmann1-5/+9
Detect symlinks as file type, set the git file mode accordingly and strip off the trailing newline in the p4 print output. Make the mode handling a bit more readable at the same time. Signed-off-by: Simon Hausmann <simon@lst.de> Acked-by: Brian Swetland <swetland@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-08-02Fix style nit in Python slicing.Libravatar Han-Wen Nienhuys1-3/+3
Python slices start at 0 by default. Signed-off-by: Han-Wen Nienhuys <hanwen@google.com> Signed-off-by: Simon Hausmann <simon@lst.de>
2007-08-02Sort output of "p4 change" in incremental import before furtherLibravatar Han-Wen Nienhuys1-1/+1
processing P4 change outputs the changes sorted for each directory separately. We want the global ordering on the changes, hence we sort. Signed-off-by: Han-Wen Nienhuys <hanwen@google.com> Signed-off-by: Simon Hausmann <simon@lst.de>
2007-07-25git-p4: Fix p4 user cache population on Windows.Libravatar Simon Hausmann1-1/+2
Fall back to USERPROFILE if HOME isn't set. Signed-off-by: Simon Hausmann <shausman@trolltech.com> Signed-off-by: Marius Storm-Olsen <marius@trolltech.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-07-18git-p4: Cleanup, used common function for listing imported p4 branchesLibravatar Simon Hausmann1-21/+5
Signed-off-by: Simon Hausmann <simon@lst.de>
2007-07-18git-p4: Fix upstream branch detection for submit/rebase with multiple branches.Libravatar Simon Hausmann1-12/+17
Don't use git name-rev to locate the upstream git-p4 branch for rebase and submit but instead locate the branch by comparing the depot paths. name-rev may produce results like wrongbranch~12 as it uses the first match. Signed-off-by: Simon Hausmann <simon@lst.de> Signed-off-by: Marius Storm-Olsen <marius@trolltech.com>
2007-07-18git-p4: Cleanup, make listExistingP4Branches a global function for later use.Libravatar Simon Hausmann1-0/+23
Signed-off-by: Simon Hausmann <simon@lst.de> Signed-off-by: Marius Storm-Olsen <marius@trolltech.com>
2007-07-17git-p4: input to "p4 files" by stdin instead of argumentsLibravatar Scott Lamb1-21/+7
This approach, suggested by Alex Riesen, bypasses the need for xargs-style argument list handling. The handling in question looks broken in a corner case with SC_ARG_MAX=4096 and final argument over 96 characters. Signed-off-by: Scott Lamb <slamb@slamb.org> Signed-off-by: Simon Hausmann <simon@lst.de>
2007-07-17git-p4: use subprocess in p4CmdListLibravatar Scott Lamb1-5/+18
This allows bidirectional piping - useful for "-x -" to avoid commandline arguments - and is a step toward bypassing the shell. Signed-off-by: Scott Lamb <slamb@slamb.org> Signed-off-by: Simon Hausmann <simon@lst.de>
2007-07-14Fix git-p4 on Windows to not use the Posix sysconf function.Libravatar Marius Storm-Olsen1-1/+5
Add condition for Windows, since it doesn't support the os.sysconf module. We hardcode the commandline limit to 2K, as that should work on most Windows platforms. Signed-off-by: Marius Storm-Olsen <marius@trolltech.com> Acked-by: Simon Hausmann <simon@lst.de> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-06-22Import branch 'git-p4' of git://repo.or.cz/fast-exportLibravatar Shawn O. Pearce3-0/+1737
Simon has asked that the git.git project include the git-p4 project as at least a contrib/fast-import within git.git. I think it makes a lot of sense, as git-p4 nicely complements the only other in-tree fast-import user: import-tars.perl. git-p4 is offered under the MIT license by its authors.