summaryrefslogtreecommitdiff
path: root/git-p4.py
AgeCommit message (Collapse)Author
2017-02-16Merge branch 'ls/p4-path-encoding'Junio C Hamano
When "git p4" imports changelist that removes paths, it failed to convert pathnames when the p4 used encoding different from the one used on the Git side. This has been corrected. * ls/p4-path-encoding: git-p4: fix git-p4.pathEncoding for removed files
2017-02-10git-p4: fix git-p4.pathEncoding for removed filesLars Schneider
In a9e38359e3 we taught git-p4 a way to re-encode path names from what was used in Perforce to UTF-8. This path re-encoding worked properly for "added" paths. "Removed" paths were not re-encoded and therefore different from the "added" paths. Consequently, these files were not removed in a git-p4 cloned Git repository because the path names did not match. Fix this by moving the re-encoding to a place that affects "added" and "removed" paths. Add a test to demonstrate the issue. Signed-off-by: Lars Schneider <larsxschneider@gmail.com> Reviewed-by: Luke Diamand <luke@diamand.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-02-02Merge branch 'gv/mingw-p4-mapuser'Junio C Hamano
"git p4" did not work well with multiple git-p4.mapUser entries on Windows. * gv/mingw-p4-mapuser: git-p4: fix git-p4.mapUser on Windows
2017-01-30git-p4: fix git-p4.mapUser on WindowsGeorge Vanburgh
When running git-p4 on Windows, with multiple git-p4.mapUser entries in git config - no user mappings are applied to the generated repository. Reproduction Steps: 1. Add multiple git-p4.mapUser entries to git config on a Windows machine 2. Attempt to clone a p4 repository None of the user mappings will be applied. This issue is actually caused by gitConfigList, using split(os.linesep) to convert the output of git config --get-all into a list. On Windows, os.linesep is equal to '\r\n' - however git.exe returns configuration with a line seperator of '\n'. This leads to the list returned by gitConfigList containing only one element - which contains the full output of git config --get-all in string form, which causes problems for the code introduced to getUserMapFromPerforceServer in 10d08a149d ("git-p4: map a P4 user to Git author name and email address", 2016-03-01) This issue should be caught by the test introduced in 10d08a1, however would require running on Windows to reproduce. Using splitlines solves this issue, by splitting config on all typical delimiters ('\n', '\r\n' etc.) Signed-off-by: George Vanburgh <gvanburgh@bloomberg.net> Reviewed-by: Luke Diamand <luke@diamand.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-01-18Merge branch 'ls/p4-retry-thrice'Junio C Hamano
A recent updates to "git p4" was not usable for older p4 but it could be made to work with minimum changes. Do so. * ls/p4-retry-thrice: git-p4: do not pass '-r 0' to p4 commands
2017-01-17Merge branch 'gv/p4-multi-path-commit-fix' into maintJunio C Hamano
"git p4" that tracks multile p4 paths imported a single changelist that touches files in these multiple paths as one commit, followed by many empty commits. This has been fixed. * gv/p4-multi-path-commit-fix: git-p4: fix multi-path changelist empty commits
2017-01-17Merge branch 'ld/p4-compare-dir-vs-symlink' into maintJunio C Hamano
"git p4" misbehaved when swapping a directory and a symbolic link. * ld/p4-compare-dir-vs-symlink: git-p4: avoid crash adding symlinked directory
2016-12-29git-p4: do not pass '-r 0' to p4 commandsIgor Kushnir
git-p4 crashes when used with a very old p4 client version that does not support the '-r <number>' option in its commands. Allow making git-p4 work with old p4 clients by setting git-p4.retries to 0. Alternatively git-p4.retries could be made opt-in. But since only very old, barely maintained p4 versions don't support the '-r' option, the setting-retries-to-0 workaround would do. The "-r retries" option is present in Perforce 2012.2 Command Reference, but absent from Perforce 2012.1 Command Reference. Signed-off-by: Igor Kushnir <igorkuo@gmail.com> Acked-by: Lars Schneider <larsxschneider@gmail.com> Reviewed-by: Luke Diamand <luke@diamand.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-12-27Merge branch 'ls/p4-lfs'Junio C Hamano
Update GitLFS integration with "git p4". * ls/p4-lfs: git-p4: add diff/merge properties to .gitattributes for GitLFS files
2016-12-27Merge branch 'gv/p4-multi-path-commit-fix'Junio C Hamano
"git p4" that tracks multile p4 paths imported a single changelist that touches files in these multiple paths as one commit, followed by many empty commits. This has been fixed. * gv/p4-multi-path-commit-fix: git-p4: fix multi-path changelist empty commits
2016-12-27Merge branch 'ld/p4-compare-dir-vs-symlink'Junio C Hamano
"git p4" misbehaved when swapping a directory and a symbolic link. * ld/p4-compare-dir-vs-symlink: git-p4: avoid crash adding symlinked directory
2016-12-20git-p4: add diff/merge properties to .gitattributes for GitLFS filesLars Schneider
The `git lfs track` command generates a .gitattributes file with diff and merge properties [1]. Set the same .gitattributes format for files tracked with GitLFS in git-p4. [1] https://github.com/git-lfs/git-lfs/blob/v1.5.3/commands/command_track.go#L121 Signed-off-by: Lars Schneider <larsxschneider@gmail.com> Reviewed-by: Luke Diamand <luke@diamand.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-12-19Merge branch 'ld/p4-worktree'Junio C Hamano
"git p4" didn't interact with the internal of .git directory correctly in the modern "git-worktree"-enabled world. * ld/p4-worktree: git-p4: support git worktrees
2016-12-19git-p4: fix multi-path changelist empty commitsGeorge Vanburgh
When importing from multiple perforce paths - we may attempt to import a changelist that contains files from two (or more) of these depot paths. Currently, this results in multiple git commits - one containing the changes, and the other(s) as empty commit(s). This behavior was introduced in commit 1f90a64891 ("git-p4: reduce number of server queries for fetches", 2015-12-19). Reproduction Steps: 1. Have a git repo cloned from a perforce repo using multiple depot paths (e.g. //depot/foo and //depot/bar). 2. Submit a single change to the perforce repo that makes changes in both //depot/foo and //depot/bar. 3. Run "git p4 sync" to sync the change from #2. Change is synced as multiple commits, one for each depot path that was affected. Using a set, instead of a list inside p4ChangesForPaths() ensures that each changelist is unique to the returned list, and therefore only a single commit is generated for each changelist. Reported-by: James Farwell <jfarwell@vmware.com> Signed-off-by: George Vanburgh <gvanburgh@bloomberg.net> Reviewed-by: Luke Diamand <luke@diamand.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-12-18git-p4: avoid crash adding symlinked directoryLuke Diamand
When submitting to P4, if git-p4 came across a symlinked directory, then during the generation of the submit diff, it would try to open it as a normal file and fail. Spot symlinks (of any type) and output a description of the symlink instead. Add a test case. Signed-off-by: Luke Diamand <luke@diamand.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-12-16Merge branch 'ls/p4-retry-thrice'Junio C Hamano
* ls/p4-retry-thrice: git-p4: add config to retry p4 commands; retry 3 times by default
2016-12-16Merge branch 'ls/p4-empty-file-on-lfs'Junio C Hamano
"git p4" LFS support was broken when LFS stores an empty blob. * ls/p4-empty-file-on-lfs: git-p4: fix empty file processing for large file system backend GitLFS
2016-12-14git-p4: support git worktreesLuke Diamand
git-p4 would attempt to find the git directory using its own specific code, which did not know about git worktrees. Rework it to use "git rev-parse --git-dir" instead. Add test cases for worktree usage and specifying git directory via --git-dir and $GIT_DIR. Signed-off-by: Luke Diamand <luke@diamand.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-12-05git-p4: fix empty file processing for large file system backend GitLFSLars Schneider
If git-p4 tried to store an empty file in GitLFS then it crashed while parsing the pointer file: oid = re.search(r'^oid \w+:(\w+)', pointerFile, re.MULTILINE).group(1) AttributeError: 'NoneType' object has no attribute 'group' This happens because GitLFS does not create a pointer file for an empty file. Teach git-p4 this behavior to fix the problem and add a test case. Signed-off-by: Lars Schneider <larsxschneider@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-12-05git-p4: add config to retry p4 commands; retry 3 times by defaultLars Schneider
P4 commands can fail due to random network issues. P4 users can counter these issues by using a retry flag supported by all p4 commands [1]. Add an integer Git config value `git-p4.retries` to define the number of retries for all p4 invocations. If the config is not defined then set the default retry count to 3. [1] https://www.perforce.com/perforce/doc.current/manuals/cmdref/global.options.html Signed-off-by: Lars Schneider <larsxschneider@gmail.com> Reviewed-by: Luke Diamand <luke@diamand.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-12-05git-p4: support updating an existing shelved changelistLuke Diamand
Adds new option "--update-shelve CHANGELIST" which updates an existing shelved changelist. The original changelist must have been created by the current user. This allows workflow something like: hack hack hack git commit git p4 submit --shelve $mail interested parties about shelved changelist make corrections git commit --amend git p4 submit --update-shelve $CHANGELIST $mail interested parties about shelved changelist etc Signed-off-by: Luke Diamand <luke@diamand.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-11-29git-p4: allow submit to create shelved changelists.Vinicius Kursancew
Add a --shelve command line argument which invokes p4 shelve instead of submitting changes. After shelving the changes are reverted from the p4 workspace. Signed-off-by: Vinicius Kursancew <viniciusalexandre@gmail.com> Reviewed-by: Luke Diamand <luke@diamand.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-08-11Spelling fixesVille Skyttä
<BAD> <CORRECTED> accidently accidentally commited committed dependancy dependency emtpy empty existance existence explicitely explicitly git-upload-achive git-upload-archive hierachy hierarchy indegee indegree intial initial mulitple multiple non-existant non-existent precendence. precedence. priviledged privileged programatically programmatically psuedo-binary pseudo-binary soemwhere somewhere successfull successful transfering transferring uncommited uncommitted unkown unknown usefull useful writting writing Signed-off-by: Ville Skyttä <ville.skytta@iki.fi> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-07-19Merge branch 'ls/p4-tmp-refs'Junio C Hamano
"git p4" used a location outside $GIT_DIR/refs/ to place its temporary branches, which has been moved to refs/git-p4-tmp/. * ls/p4-tmp-refs: git-p4: place temporary refs used for branch import under refs/git-p4-tmp
2016-07-11Merge branch 'ao/p4-has-branch-prefix-fix' into maintJunio C Hamano
A bug, which caused "git p4" while running under verbose mode to report paths that are omitted due to branch prefix incorrectly, has been fixed; the command said "Ignoring file outside of prefix" for paths that are _inside_. * ao/p4-has-branch-prefix-fix: git-p4: correct hasBranchPrefix verbose output
2016-07-08git-p4: place temporary refs used for branch import under refs/git-p4-tmpLars Schneider
Git-P4 used to place temporary refs under "git-p4-tmp". Since 3da1f37 Git checks that all refs are placed under "refs". Instruct Git-P4 to place temporary refs under "refs/git-p4-tmp". There are no backwards compatibility considerations as these refs are transient. Use "git show-ref --verify" to check the (non-)existience of the refs instead of file checks assuming the file-based ref backend. All refs under "refs" are shared across all worktrees. This is not desired for temporary Git-P4 refs and will be adressed in a later patch. Signed-off-by: Lars Schneider <larsxschneider@gmail.com> Reviewed-by: Vitor Antunes <vitor.hda@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-07-06Merge branch 'ao/p4-has-branch-prefix-fix'Junio C Hamano
A bug, which caused "git p4" while running under verbose mode to report paths that are omitted due to branch prefix incorrectly, has been fixed; the command said "Ignoring file outside of prefix" for paths that are _inside_. * ao/p4-has-branch-prefix-fix: git-p4: correct hasBranchPrefix verbose output
2016-06-22git-p4: correct hasBranchPrefix verbose outputAndrew Oakley
The logic here was inverted, you got a message saying the file is ignored for each file that is not ignored. Signed-off-by: Andrew Oakley <aoakley@roku.com> Acked-by: Lars Schneider <larsxschneider@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-05-10Merge branch 'ls/p4-lfs'Junio C Hamano
Recent update to Git LFS broke "git p4" by changing the output from its "lfs pointer" subcommand. * ls/p4-lfs: git-p4: fix Git LFS pointer parsing travis-ci: express Linux/OS X dependency versions more clearly travis-ci: update Git-LFS and P4 to the latest version
2016-04-28git-p4: fix Git LFS pointer parsingLars Schneider
Git LFS 1.2.0 removed a preamble from the output of the 'git lfs pointer' command [1] which broke the parsing of this output. Adjust the parser to support the old and the new format. Please note that this patch slightly changes the second return parameter from a list of LF terminated strings to a single string that contains a number of LF characters. [1] https://github.com/github/git-lfs/commit/da2935d9a739592bc775c98d8ef4df9c72ea3b43 Signed-off-by: Lars Schneider <larsxschneider@gmail.com> Helped-by: Sebastian Schuberth <sschuberth@gmail.com> Helped-by: Ben Woosley <ben.woosley@gmail.com> Signed-off-by: Lars Schneider <larsxschneider@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-04-19git-p4: add P4 jobs to git commit messageJan Durovec
When migrating from Perforce to git the information about P4 jobs associated with P4 changelists is lost. Having these jobs listed on messages of related git commits enables smooth migration for projects that take advantage of e.g. JIRA integration (which uses jobs on Perforce side and parses commit messages on git side). The jobs are added to the message in the same format as is expected when migrating in the reverse direction. Signed-off-by: Jan Durovec <jan.durovec@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-04-06Merge branch 'ls/p4-map-user'Junio C Hamano
"git p4" now allows P4 author names to be mapped to Git author names. * ls/p4-map-user: git-p4: map a P4 user to Git author name and email address
2016-03-15git-p4: map a P4 user to Git author name and email addressLars Schneider
Map a P4 user to a specific name and email address in Git with the "git-p4.mapUser" config. The config value must be a string adhering to the format "p4user = First Lastname <email@address.com>". Signed-off-by: Lars Schneider <larsxschneider@gmail.com> Reviewed-by: Luke Diamand <luke@diamand.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-01-13git-p4.py: add support for filetype changeRomain Picard
After changing the type of a file in the git repository, it is not possible to "git p4 publish" the commit to perforce. This is due to the fact that the git "T" status is not handled in git-p4.py. This can typically occur when replacing an existing file with a symbolic link. The "T" modifier is now supported in git-p4.py. When a file type has changed, inform perforce with the "p4 edit -f auto" command. Signed-off-by: Romain Picard <romain.picard@oakbits.com> Acked-by: Luke Diamand <luke@diamand.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-12-28Merge branch 'sh/p4-multi-depot'Junio C Hamano
"git p4" when interacting with multiple depots at the same time used to incorrectly drop changes. * sh/p4-multi-depot: git-p4: reduce number of server queries for fetches git-p4: support multiple depot paths in p4 submit git-p4: failing test case for skipping changes with multiple depots
2015-12-21git-p4: reduce number of server queries for fetchesSam Hocevar
When fetching changes from a depot using a full client spec, there is no need to perform as many queries as there are top-level paths in the client spec. Instead we query all changes in chronological order, also getting rid of the need to sort the results and remove duplicates. Signed-off-by: Sam Hocevar <sam@hocevar.net> Signed-off-by: Luke Diamand <luke@diamand.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-12-21git-p4: support multiple depot paths in p4 submitSam Hocevar
When submitting from a repository that was cloned using a client spec, use the full list of paths when ruling out files that are outside the view. This fixes a bug where only files pertaining to the first path would be included in the p4 submit. Signed-off-by: Sam Hocevar <sam@hocevar.net> Signed-off-by: Luke Diamand <luke@diamand.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-12-15Merge branch 'ls/p4-keep-empty-commits'Junio C Hamano
"git p4" used to import Perforce CLs that touch only paths outside the client spec as empty commits. It has been corrected to ignore them instead, with a new configuration git-p4.keepEmptyCommits as a backward compatibility knob. * ls/p4-keep-empty-commits: git-p4: add option to keep empty commits
2015-12-10git-p4: add option to keep empty commitsLars Schneider
A changelist that contains only excluded files due to a client spec was imported as an empty commit. Fix that issue by ignoring these commits. Add option "git-p4.keepEmptyCommits" to make the previous behavior available. Signed-off-by: Lars Schneider <larsxschneider@gmail.com> Helped-by: Pete Harlan Acked-by: Luke Diamand <luke@diamand.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-12-01Merge branch 'maint'Jeff King
* maint: http: treat config options sslCAPath and sslCAInfo as paths Documentation/diff: give --word-diff-regex=. example filter-branch: deal with object name vs. pathname ambiguity in tree-filter check-ignore: correct documentation about output git-p4: clean up after p4 submit failure git-p4: work with a detached head git-p4: add option to system() to return subshell status git-p4: add failing test for submit from detached head remote-http(s): support SOCKS proxies t5813: avoid creating urls that break on cygwin Escape Git's exec path in contrib/rerere-train.sh script allow hooks to ignore their standard input stream rebase-i-exec: Allow space in SHELL_PATH Documentation: make environment variable formatting more consistent
2015-12-01Merge branch 'eg/p4-submit-catch-failure' into maintJeff King
Just like the working tree is cleaned up when the user cancelled submission in P4Submit.applyCommit(), clean up the mess if "p4 submit" fails. * eg/p4-submit-catch-failure: git-p4: clean up after p4 submit failure
2015-12-01Merge branch 'ld/p4-detached-head' into maintJeff King
Make git-p4 work on a detached head. * ld/p4-detached-head: git-p4: work with a detached head git-p4: add option to system() to return subshell status git-p4: add failing test for submit from detached head
2015-11-24git-p4: clean up after p4 submit failureGIRARD Etienne
When "p4 submit" command fails in P4Submit.applyCommit, the workspace is left with the changes. We already have code to revert the changes to the workspace when the user decides to cancel submission by aborting the editor that edits the change description, and we should treat the "p4 submit" failure the same way. Clean the workspace if p4_write_pipe raised SystemExit, so that the user don't have to do it themselves. Signed-off-by: GIRARD Etienne <egirard@murex.com> Signed-off-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Luke Diamand <luke@diamand.org> Signed-off-by: Jeff King <peff@peff.net>
2015-11-24git-p4: work with a detached headLuke Diamand
When submitting, git-p4 finds the current branch in order to know if it is allowed to submit (configuration "git-p4.allowSubmit"). On a detached head, detecting the branch would fail, and git-p4 would report a cryptic error. This change teaches git-p4 to recognise a detached head and submit successfully. Signed-off-by: Luke Diamand <luke@diamand.org> Signed-off-by: Jeff King <peff@peff.net>
2015-11-24git-p4: add option to system() to return subshell statusLuke Diamand
Add an optional parameter ignore_error to the git-p4 system() function. If used, it will return the subshell exit status rather than throwing an exception. Signed-off-by: Luke Diamand <luke@diamand.org> Signed-off-by: Jeff King <peff@peff.net>
2015-11-03Merge branch 'ls/p4-translation-failure' into maintJunio C Hamano
Work around "git p4" failing when the P4 depot records the contents in UTF-16 without UTF-16 BOM. * ls/p4-translation-failure: git-p4: handle "Translation of file content failed" git-p4: add test case for "Translation of file content failed" error
2015-11-03Merge branch 'ld/p4-import-labels' into maintJunio C Hamano
Correct "git p4 --detect-labels" so that it does not fail to create a tag that points at a commit that is also being imported. * ld/p4-import-labels: git-p4: fix P4 label import for unprocessed commits git-p4: do not terminate creating tag for unknown commit git-p4: failing test for ignoring invalid p4 labels
2015-10-26Merge branch 'dk/p4-import-ctypes'Junio C Hamano
"git-p4" tried to use from ctypes module without first importing it. * dk/p4-import-ctypes: git-p4: import the ctypes module
2015-10-20git-p4: import the ctypes moduleDennis Kaarsemaker
The ctypes module is used on windows to calculate free disk space, so it must be imported. We won't need it on other platforms, but the module is available in Python 2.5 and newer, so importing it unconditionally is harmless. Signed-off-by: Dennis Kaarsemaker <dennis@kaarsemaker.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-10-15Merge branch 'ls/p4-lfs'Junio C Hamano
Teach "git p4" to send large blobs outside the repository by talking to Git LFS. * ls/p4-lfs: git-p4: add Git LFS backend for large file system git-p4: add support for large file systems git-p4: check free space during streaming git-p4: add file streaming progress in verbose mode git-p4: return an empty list if a list config has no values git-p4: add gitConfigInt reader git-p4: add optional type specifier to gitConfig reader