summaryrefslogtreecommitdiff
path: root/git-p4.py
Commit message (Collapse)AuthorAgeFilesLines
* git-p4: fix submit in non --prepare-p4-only modemc/git-p4-prepare-p4-onlyMaxime Coste2014-06-131-6/+6
| | | | | | | | | | b4073bb3 (git-p4: Do not include diff in spec file when just preparing p4, 2014-05-24) broke git p4 submit, here is a proper fix, including proper handling for windows end of lines. Signed-off-by: Maxime Coste <frrrwww@gmail.com> Acked-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* git-p4: Do not include diff in spec file when just preparing p4mc/git-p4-pre-are-p4-onlyMaxime Coste2014-05-271-23/+26
| | | | | | | | | | | | | | | | | | The diff information render the spec file unusable as is by p4, do not include it when run with --prepare-p4-only so that the given file can be directly passed to p4. With --prepare-p4-only, git-p4 already tells the user it can use p4 submit with the generated spec file. This fails because of the diff being present in the file. Not including the diff fixes that. Without --prepare-p4-only, keeping the diff makes sense for a quick review of the patch before submitting it. And does not cause problems with p4 as we remove it programmatically. Signed-off-by: Maxime Coste <frrrwww@gmail.com> Acked-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Merge branch 'cl/p4-use-diff-tree'Junio C Hamano2014-05-071-1/+1
|\ | | | | | | | | | | | | Fixes a regression in 1.9.0 with an obviously correct single-liner. * cl/p4-use-diff-tree: git-p4: format-patch to diff-tree change breaks binary patches
| * git-p4: format-patch to diff-tree change breaks binary patchescl/p4-use-diff-treeTolga Ceylan2014-05-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When applying binary patches a full index is required. format-patch already handles this, but diff-tree needs '--full-index' argument to always output full index. When git-p4 runs git-apply to test the patch, git-apply rejects the patch due to abbreviated blob object names. This is the error message git-apply emits in this case: error: cannot apply binary patch to '<filename>' without full index line error: <filename>: patch does not apply Signed-off-by: Tolga Ceylan <tolga.ceylan@gmail.com> Acked-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | git-p4: explicitly specify that HEAD is a revisionVlad Dogaru2014-04-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 'git p4 rebase' fails with the following message if there is a file named HEAD in the current directory: fatal: ambiguous argument 'HEAD': both revision and filename Use '--' to separate paths from revisions, like this: 'git <command> [<revision>...] -- [<file>...]' Take the suggestion above and explicitly state that HEAD should be treated as a revision. Signed-off-by: Vlad Dogaru <vdogaru@ixiacom.com> Acked-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | git p4: fix an error message when "p4 where" failsPete Wyckoff2014-01-221-1/+1
| | | | | | | | | | | | | | | | | | | | When "p4 where" fails, for whatever reason, the error message tries to show an undefined variable. This minor bug applies only when using a client spec, and was introduced recently in 9d57c4a (git p4: implement view spec wildcards with "p4 where", 2013-08-30). Signed-off-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | git p4: handle files with wildcards when doing RCS scrubbingPete Wyckoff2014-01-221-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | Commit 9d7d446 (git p4: submit files with wildcards, 2012-04-29) fixed problems with handling files that had p4 wildcard characters, like "@" and "*". But it missed one case, that of RCS keyword scrubbing, which uses "p4 fstat" to extract type information. Fix it by calling wildcard_encode() on the raw filename. Signed-off-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | git p4 test: do not pollute /tmpPete Wyckoff2014-01-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Generating the submit template for p4 uses tempfile.mkstemp(), which by default puts files in /tmp. For a test that fails, possibly on purpose, this is not cleaned up. Run with TMPDIR pointing into the trash directory so the temp files go away with the test results. To do this required some other minor changes. First, the editor is launched using system(editor + " " + template_file), using shell expansion to build the command string. This doesn't work if editor has a space in it. And is generally unwise as it's easy to fool the shell into doing extra work. Exec the args directly, without shell expansion. Second, without shell expansion, the trick of "P4EDITOR=:" used in the tests doesn't work. Use a real command, true, as the non-interactive editor for testing. Signed-off-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | git p4: work around p4 bug that causes empty symlinksPete Wyckoff2014-01-221-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Damien Gérard highlights an interesting problem. Some p4 repositories end up with symlinks that have an empty target. It is not possible to create this with current p4, but they do indeed exist. The effect in git p4 is that "p4 print" on the symlink returns an empty string, confusing the curret symlink-handling code. Such broken repositories cause problems in p4 as well, even with no git involved. In p4, syncing to a change that includes a bogus symlink causes errors: //depot/empty-symlink - updating /home/me/p4/empty-symlink rename: /home/me/p4/empty-symlink: No such file or directory and leaves no symlink. In git, replicate the p4 behavior by ignoring these bad symlinks. If, in a later p4 revision, the symlink happens to point to something non-null, the symlink will be replaced properly. Add a big test for all this too. This happens to be a regression introduced by 1292df1 (git-p4: Fix occasional truncation of symlink contents., 2013-08-08) and appeared first in 1.8.5. But it shows up only in p4 repositories of dubious character, so can wait for a proper release. Tested-by: Damien Gérard <damien@iwi.me> Signed-off-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Merge branch 'cl/p4-use-diff-tree'Junio C Hamano2013-12-121-1/+1
|\ \ | |/ | | | | | | * cl/p4-use-diff-tree: git p4: Use git diff-tree instead of format-patch
| * git p4: Use git diff-tree instead of format-patchCrestez Dan Leonard2013-11-221-1/+1
| | | | | | | | | | | | | | | | | | | | The output of git format-patch can vary with user preferences. In particular setting diff.noprefix will break the "git apply" that is done as part of "git p4 submit". Acked-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Crestez Dan Leonard <cdleonard@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Merge branch 'ks/p4-view-spec'Junio C Hamano2013-09-181-164/+59
|\ \ | | | | | | | | | | | | | | | * ks/p4-view-spec: git p4: implement view spec wildcards with "p4 where" git p4 test: sanitize P4CHARSET
| * | git p4: implement view spec wildcards with "p4 where"ks/p4-view-specKazuki Saitoh2013-09-031-164/+59
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | "git p4" does not support many of the view wildcards, such as * and %%n. It only knows the common ... mapping, and exclusions. Redo the entire wildcard code around the idea of directly querying the p4 server for the mapping. For each commit, invoke "p4 where" with committed file paths as args and use the client mapping to decide where the file goes in git. This simplifies a lot of code, and adds support for all wildcards supported by p4. Downside is that there is probably a 20%-ish slowdown with this approach. [pw: redo code and tests] Signed-off-by: Kazuki Saitoh <ksaitoh560@gmail.com> Signed-off-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | git-p4: Fix occasional truncation of symlink contents.aj/p4-symlink-lose-nlAlexandru Juncu2013-08-121-2/+6
|/ | | | | | | | | | | | Symlink contents in p4 print sometimes have a trailing new line character, but sometimes it doesn't. git-p4 should only remove the last character if that character is '\n'. Signed-off-by: Alex Juncu <ajuncu@ixiacom.com> Signed-off-by: Alex Badea <abadea@ixiacom.com> Acked-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* many small typofixesob/typofixesOndřej Bílka2013-07-291-1/+1
| | | | | | Signed-off-by: Ondřej Bílka <neleai@seznam.cz> Reviewed-by: Marc Branchaud <marcnarc@xiplink.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Merge branch 'vl/typofix'Junio C Hamano2013-06-261-1/+1
|\ | | | | | | | | * vl/typofix: random typofixes (committed missing a 't', successful missing an 's')
| * random typofixes (committed missing a 't', successful missing an 's')Veres Lajos2013-06-191-1/+1
| | | | | | | | | | Signed-off-by: Veres Lajos <vlajos@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | git p4: avoid expanding client paths in chdirMiklós Fazekas2013-03-111-7/+22
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | The generic chdir() helper sets the PWD environment variable, as that is what is used by p4 to know its current working directory. Normally the shell would do this, but in git-p4, we must do it by hand. However, when the path contains a symbolic link, os.getcwd() will return the physical location. If the p4 client specification includes symlinks, setting PWD to the physical location causes p4 to think it is not inside the client workspace. It complains, e.g. Path /vol/bar/projects/foo/... is not under client root /p/foo One workaround is to use AltRoots in the p4 client specification, but it is cleaner to handle it directly in git-p4. Other uses of chdir still require setting PWD to an absolute path so p4 features like P4CONFIG work. See bf1d68f (git-p4: use absolute directory for PWD env var, 2011-12-09). [ pw: tweak patch and commit message ] Thanks-to: John Keeping <john@keeping.me.uk> Signed-off-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Merge branch 'pw/git-p4-on-cygwin'Junio C Hamano2013-02-041-39/+80
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Improve "git p4" on Cygwin. * pw/git-p4-on-cygwin: (21 commits) git p4: introduce gitConfigBool git p4: avoid shell when calling git config git p4: avoid shell when invoking git config --get-all git p4: avoid shell when invoking git rev-list git p4: avoid shell when mapping users git p4: disable read-only attribute before deleting git p4 test: use test_chmod for cygwin git p4: cygwin p4 client does not mark read-only git p4 test: avoid wildcard * in windows git p4 test: use LineEnd unix in windows tests too git p4 test: newline handling git p4: scrub crlf for utf16 files on windows git p4: remove unreachable windows \r\n conversion code git p4 test: translate windows paths for cygwin git p4 test: start p4d inside its db dir git p4 test: use client_view in t9806 git p4 test: avoid loop in client_view git p4 test: use client_view to build the initial client git p4: generate better error message for bad depot path git p4: remove unused imports ...
| * git p4: introduce gitConfigBoolPete Wyckoff2013-01-261-19/+26
| | | | | | | | | | | | | | | | | | Make the intent of "--bool" more obvious by returning a direct True or False value. Convert a couple non-bool users with obvious bool intent. Signed-off-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * git p4: avoid shell when calling git configPete Wyckoff2013-01-261-6/+9
| | | | | | | | | | Signed-off-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * git p4: avoid shell when invoking git config --get-allPete Wyckoff2013-01-261-1/+2
| | | | | | | | | | Signed-off-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * git p4: avoid shell when invoking git rev-listPete Wyckoff2013-01-261-2/+3
| | | | | | | | | | | | | | | | | | | | Invoke git rev-list directly, avoiding the shell, in P4Submit and P4Sync. The overhead of starting extra processes is significant in cygwin; this speeds things up on that platform. Signed-off-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * git p4: avoid shell when mapping usersPete Wyckoff2013-01-261-1/+2
| | | | | | | | | | | | | | | | The extra quoting and double-% are unneeded, just to work around the shell. Instead, avoid the shell indirection. Signed-off-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * git p4: disable read-only attribute before deletingPete Wyckoff2013-01-261-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | On windows, p4 marks un-edited files as read-only. Not only are they read-only, but also they cannot be deleted. Remove the read-only attribute before deleting in both the copy and rename cases. This also happens in the RCS cleanup code, where a file is marked to be deleted, but must first be edited to remove adjust the keyword lines. Make sure it is editable before patching. Signed-off-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * git p4: scrub crlf for utf16 files on windowsPete Wyckoff2013-01-261-1/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Files of type utf16 are handled with "p4 print" instead of the normal "p4 -G print" interface due to how the latter does not produce correct output. See 55aa571 (git-p4: handle utf16 filetype properly, 2011-09-17) for details. On windows, though, "p4 print" can not be told which line endings to use, as there is no underlying client, and always chooses crlf, even for utf16 files. Convert the \r\n into \n when importing utf16 files. The fix for this is complex, in that the problem is a property of the NT version of p4. There are old versions of p4 that were compiled directly for cygwin that should not be subjected to text replacement. The right check here, then, is to look at the p4 version, not the OS version. Note also that on cygwin, platform.system() is "CYGWIN_NT-5.1" or similar, not "Windows". Add a function to memoize the p4 version string and use it to check for "/NT", indicating the Windows build of p4. Signed-off-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * git p4: remove unreachable windows \r\n conversion codePete Wyckoff2013-01-261-9/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replacing \r\n with \n on windows was added in c1f9197 (Replace \r\n with \n when importing from p4 on Windows, 2007-05-24), to work around an oddity with "p4 print" on windows. Text files are printed with "\r\r\n" endings, regardless of whether they were created on unix or windows, and regardless of the client LineEnd setting. As of d2c6dd3 (use p4CmdList() to get file contents in Python dicts. This is more robust., 2007-05-23), git-p4 uses "p4 -G print", which generates files in a raw format. As the native line ending format if p4 is \n, there will be no \r\n in the raw text. Actually, it is possible to generate a text file so that the p4 representation includes embedded \r\n, even though this is not normal on either windows or unix. In that case the code would have mistakenly stripped them out, but now they will be left intact. More information on how p4 deals with line endings is here: http://kb.perforce.com/article/63 Signed-off-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * git p4: generate better error message for bad depot pathPete Wyckoff2013-01-261-0/+1
| | | | | | | | | | | | | | | | Depot paths must start with //. Exit with a better explanation when a bad depot path is supplied. Signed-off-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * git p4: remove unused importsPete Wyckoff2013-01-261-5/+9
| | | | | | | | | | | | | | | | | | | | Found by "pyflakes" checker tool. Modules shelve, getopt were unused. Module os.path is exported by os. Reformat one-per-line as is PEP008 suggested style. Signed-off-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * git p4: temp branch name should use / even on windowsPete Wyckoff2013-01-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit fed2369 (git-p4: Search for parent commit on branch creation, 2012-01-25) uses temporary branches to help find the parent of a new p4 branch. The temp branches are of the form "git-p4-tmp/%d" for some p4 change number. Mistakenly, this string was made using os.path.join() instead of just string concatenation. On windows, this turns into a backslash (\), which is not allowed in git branch names. Reported-by: Casey McGinty <casey.mcginty@gmail.com> Signed-off-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Merge branch 'bc/git-p4-for-python-2.4'Junio C Hamano2013-02-011-4/+26
|\ \ | |/ |/| | | | | | | | | | | | | | | With small updates to remove dependency on newer features of Python, keep git-p4 usable with older Python. * bc/git-p4-for-python-2.4: INSTALL: git-p4 does not support Python 3 git-p4.py: support Python 2.4 git-p4.py: support Python 2.5
| * git-p4.py: support Python 2.4Brandon Casey2013-01-261-3/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Python 2.4 lacks the following features: subprocess.check_call struct.pack_into Take a cue from 460d1026 and provide an implementation of the CalledProcessError exception. Then replace the calls to subproccess.check_call with calls to subprocess.call that check the return status and raise a CalledProcessError exception if necessary. The struct.pack_into in t/9802 can be converted into a single struct.pack call which is available in Python 2.4. Signed-off-by: Brandon Casey <bcasey@nvidia.com> Acked-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * git-p4.py: support Python 2.5Brandon Casey2013-01-261-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Python 2.5 and older do not accept None as the first argument to translate() and complain with: TypeError: expected a character buffer object As suggested by Pete Wyckoff, let's just replace the call to translate() with a regex search which should be more clear and more portable. This allows git-p4 to be used with Python 2.5. Signed-off-by: Brandon Casey <bcasey@nvidia.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Merge branch 'pw/p4-branch-fixes'Junio C Hamano2013-01-211-45/+107
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix "git p4" around branch handling. * pw/p4-branch-fixes: git p4: fix submit when no master branch git p4 test: keep P4CLIENT changes inside subshells git p4: fix sync --branch when no master branch git p4: fail gracefully on sync with no master branch git p4: rearrange self.initialParent use git p4: allow short ref names to --branch git p4 doc: fix branch detection example git p4: clone --branch should checkout master git p4: verify expected refs in clone --bare test git p4: create p4/HEAD on initial clone git p4: inline listExistingP4GitBranches git p4: add comments to p4BranchesInGit git p4: rearrange and simplify hasOrigin handling git p4: test sync/clone --branch behavior
| * | git p4: fix submit when no master branchPete Wyckoff2013-01-151-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | It finds its upstream and applies the commit properly, but the sync step will fail unless it is told which branch to work on. Signed-off-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | git p4: fix sync --branch when no master branchPete Wyckoff2013-01-151-3/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | It is legal to sync a branch with a different name than refs/remotes/p4/master, and to do so even when master does not exist. Signed-off-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | git p4: fail gracefully on sync with no master branchPete Wyckoff2013-01-151-2/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If --branch was used to build a repository with no refs/remotes/p4/master, future syncs will not know which branch to sync. Notice this situation and print a helpful error message. Signed-off-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | git p4: rearrange self.initialParent usePete Wyckoff2013-01-151-3/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | This was set in a couple of places, both of which were very far away from its use. Move it a bit closer to importChanges(), and add some comments. Signed-off-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | git p4: allow short ref names to --branchPete Wyckoff2013-01-151-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For a clone or sync, --branch says where the newly imported branch should go, or which existing branch to sync up. It takes an argument, which is currently either something that starts with "refs/", or if not, "refs/heads/p4" is prepended. Putting it in heads seems like a bad default; these should go in remotes/p4/ in most situations. Make that the new default, and be more liberal in the form of the branch name. Signed-off-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | git p4: clone --branch should checkout masterPete Wyckoff2013-01-151-11/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When using the --branch argument to "git p4 clone", one might specify a destination for p4 changes different from the default refs/remotes/p4/master. Both cases should create a master branch and checkout files. Signed-off-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | git p4: create p4/HEAD on initial clonePete Wyckoff2013-01-151-4/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There is code to create a symbolic reference from p4/HEAD to p4/master. This allows saying "git show p4" as a shortcut to "git show p4/master", for example. But this reference was only created on the second "git p4 sync" (or first sync after a clone). Make it work on the initial clone or sync. Signed-off-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | git p4: inline listExistingP4GitBranchesPete Wyckoff2013-01-151-8/+6
| | | | | | | | | | | | | | | | | | | | | | | | It is four lines of code used in only one place. Simplify by including it where it is used. Signed-off-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | git p4: add comments to p4BranchesInGitPete Wyckoff2013-01-151-8/+17
| | | | | | | | | | | | | | | Signed-off-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | git p4: rearrange and simplify hasOrigin handlingPete Wyckoff2013-01-151-7/+7
| |/ | | | | | | | | Signed-off-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Add checks to Python scripts for version dependencies.Eric S. Raymond2012-12-281-1/+7
|/ | | | | Signed-off-by: Eric S. Raymond <esr@thyrsus.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* git p4: remove unneeded cmd initializationPete Wyckoff2012-11-261-1/+0
| | | | | | | It confuses pylint, and is never needed. Signed-off-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* git p4: fix labelDetails typo in exceptionPete Wyckoff2012-11-261-1/+1
| | | | | Signed-off-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* git p4: catch p4 errors when streaming file contentsPete Wyckoff2012-11-261-7/+31
| | | | | | | | | | | | | | | Error messages that arise during the "p4 print" phase of generating commits were silently ignored. Catch them, abort the fast-import, and exit. Without this fix, the sync/clone appears to work, but files that are inaccessible by the p4d server will still be imported to git, although without the proper contents. Instead the errant files will contain a p4 error message, such as "Librarian checkout //depot/path failed". Signed-off-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* git p4: handle servers without move supportPete Wyckoff2012-11-261-1/+20
| | | | | | | | | | | | | | | Support for the "p4 move" command was added in 8e9497c (git p4: add support for 'p4 move' in P4Submit, 2012-07-12), which checks to make sure that the client and server support the command. But older versions of p4d may not handle the "-k" argument, and newer p4d allow disabling "p4 move" with a configuration setting. Check for both these cases by testing a p4 move command on bogus filenames and looking for strings in the error messages. Reported-by: Vitor Antunes <vitor.hda@gmail.com> Signed-off-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* git p4: catch p4 describe errorsPete Wyckoff2012-11-261-9/+26
| | | | | | | | | | | | | | | | Group the two calls to "p4 describe" into a new helper function, and try to validate the p4 results. The current behavior when p4 describe fails is to die with a python backtrace. The new behavior will print the full response. This does not solve any particular problem, but adds more checking in hopes of narrowing down odd behavior seen on at least two occasions. Based-on-patch-by: Matt Arsenault <arsenm2@gmail.com> Reported-by: Arthur <a.foulon@amesys.fr> Signed-off-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>