This allows to do different processing based on the filename. For some files it might be necessary not to do any replacements.
Perforce can create a label with files from different changelists. If fuzzyTags is set we create the label with the newest changelist if we encounter such a situation.
If this is the first commit in a (existing) branch in the fast-import file we have to specify the "from" parent, otherwise git won't connect it to the existing branch. This is true at least for git 18.104.22.168.
This fixes a problem when importing branches: if the new branch in Perforce is a subset of the parent branch the import didn't work as expected: the entire parent branch got imported into git. The reason is the "from" line. This means that we shouldn't write the "from" line. According to git documentation these lines can be omitted. In that case it will take the previous commit of the current branch. Since Perforce only allows linear history this should be sufficient. If we start a new branch we list all the files included in that branch, so we can't add "from" if we want the trees in Perforce and git to match (otherwise git starts out with the "from" tree instead of an empty tree).
This change adds three new parameters to the sync (and clone) command: --tree-filter, --msg-filter, and --content-filter. All three take the path to a filter script. Note that the path should be an absolute path for the scripts to work correctly. These filter scripts allow to apply tree, log message, and/or content filters during the import of a change. A tree filter is a script that gets the path of one file (in p4 notation, e.g. //depot/branch/file.txt) on stdin. It can output a modified path on stdout, or return an empty string to ignore this file. The msg filter is a script that gets the commit message on stdin and returns a modified commit message. The content filter gets called for text files and is passed the name of a temporary file on stdin and can modify that file. These filters are useful when importing an entire p4 repo. They allow to rearrange the location of some files (or ignore files that accidentally got submitted in p4). The content filter is useful to do whitespace cleanup or remove/replace some file content that should not be in a repo, e.g. passwords.
When the files included by the view spec of a label doesn't match the files really included in the label, we normally don't create a tag. When the option --fuzzy-tags is specified on the command line all files and revisions included in the label are compared with the files and revisions in the repository. If all files match we still create the label. In other words, we create a label if the files included in the label is a subset of the files in the repository.
When we get an error processing the cached user list but the parameter --no-getuserlist was specified on the command line, we still should not get the user list from the p4 server. Instead just quit processing the rest of the cached list.
When the parameter --no-getuserlist is passed to the git-p4 sync or rebase command, the cached userlist (~/.gitp4-usercache.txt) will be used even when an author of a commit can't be find in the cached list. Normally the userlist is retrieved from Perforce when an author can't be found. The use of the parameter allows the use of hand-tailored user lists that contain historical users that are no longer in the Perforce user database.
When importing a repo, the time on the initial commit had been just "now". But this causes problems when trying to share among git-p4 repos that were created identically, although at different times. Instead, use the time in the top-most p4 change as the time for the git import commit. Signed-off-by: Pete Wyckoff <firstname.lastname@example.org> Acked-by: Luke Diamand <email@example.com> Signed-off-by: Junio C Hamano <firstname.lastname@example.org>
Error output will look like this: glom$ git p4 clone //deopt Importing from //deopt into . Reinitialized existing Git repository in /tmp/x/.git/ Doing initial import of //deopt from revision #head into refs/remotes/p4/master p4 returned an error: //deopt/... - must refer to client glom. This particular p4 error is misleading. Perhaps the depot path was misspelled. Depot path: //deopt Signed-off-by: Pete Wyckoff <email@example.com> Signed-off-by: Junio C Hamano <firstname.lastname@example.org>
Some p4 failures result in an error, but the info['code'] is not set. These include a bad p4 executable, or a core dump from p4, and other odd internal errors where p4 fails to generate proper marshaled output. Make sure the info key exists before using it to avoid a python traceback. Signed-off-by: Pete Wyckoff <email@example.com> Signed-off-by: Junio C Hamano <firstname.lastname@example.org>
562d53f (git-p4: Fix sync errors due to new server version, 2010-01-21) taught git-p4 sync to recognize the new move/delete type, but this type can also show up in an initial clone and labels output. Instead of replicating the support in three places, hoist the definition somewhere global. Signed-off-by: Pete Wyckoff <email@example.com> Acked-By: Tor Arvid Lund <firstname.lastname@example.org> Signed-off-by: Junio C Hamano <email@example.com>
Perforce does not strictly require the usage of branch specifications to create branches. In these cases the branch detection code of git-p4 will not be able to import them. This patch adds support for git-p4.branchList configuration option, allowing branches to be defined in git config. Signed-off-by: Vitor Antunes <firstname.lastname@example.org> Signed-off-by: Junio C Hamano <email@example.com>
All branches in the Perforce server are downloaded to allow branch detection. If you have a centralized server on a remote location and there is a big number of branches this operation can take some time. This patch adds the configuration option git-p4.branchUser to allow filtering the branch list by user. Although this limits the branch maintenance in Perforce to be done by a single user, it might be an advantage when the number of branches being used in a specific depot is very small when compared with the branches available in the server. Signed-off-by: Vitor Antunes <firstname.lastname@example.org> Acked-by: Pete Wyckoff <email@example.com> Signed-off-by: Junio C Hamano <firstname.lastname@example.org>