aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/git-p4.txt
AgeCommit message (Collapse)AuthorFilesLines
2022-05-04git-p4: improve encoding handling to support inconsistent encodingsTao Klerks1-1/+36
git-p4 is designed to run correctly under python2.7 and python3, but its functional behavior wrt importing user-entered text differs across these environments: Under python2, git-p4 "naively" writes the Perforce bytestream into git metadata (and does not set an "encoding" header on the commits); this means that any non-utf-8 byte sequences end up creating invalidly-encoded commit metadata in git. Under python3, git-p4 attempts to decode the Perforce bytestream as utf-8 data, and fails badly (with an unhelpful error) when non-utf-8 data is encountered. Perforce clients (especially p4v) encourage user entry of changelist descriptions (and user full names) in OS-local encoding, and store the resulting bytestream to the server unmodified - such that different clients can end up creating mutually-unintelligible messages. The most common inconsistency, in many Perforce environments, is likely to be utf-8 (typical in linux) vs cp-1252 (typical in windows). Make the changelist-description- and user-fullname-handling code python-runtime-agnostic, introducing three "strategies" selectable via config: - 'passthrough', behaving as previously under python2, - 'strict', behaving as previously under python3, and - 'fallback', favoring utf-8 but supporting a secondary encoding when utf-8 decoding fails, and finally escaping high-range bytes if the decoding with the secondary encoding also fails. Keep the python2 default behavior as-is ('legacy' strategy), but switch the python3 default strategy to 'fallback' with default fallback encoding 'cp1252'. Also include tests exercising these encoding strategies, documentation for the new config, and improve the user-facing error messages when decoding does fail. Signed-off-by: Tao Klerks <tao@klerks.biz> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2021-11-09doc: use only hyphens as word separators in placeholdersJean-Noël Avila1-3/+3
According to CodingGuidelines, multi-word placeholders should use hyphens as word separators. Signed-off-by: Jean-Noël Avila <jn.avila@free.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com> Reviewed-by: Eli Schwartz <eschwartz@archlinux.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2021-10-28doc: split placeholders as individual tokensJean-Noël Avila1-1/+1
The placeholders represent atoms of tokens and must not be aggregates. Signed-off-by: Jean-Noël Avila <jn.avila@free.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2021-04-10doc lint: lint and fix missing "GIT" end sectionsÆvar Arnfjörð Bjarmason1-0/+4
Lint for and fix the three manual pages that were missing the standard "Part of the linkgit:git[1] suite" end section. We only do this for the man[157] section documents (we don't have anything outside those sections), not files to be included, howto *.txt files etc. We could also add this to the existing (and then renamed) lint-gitlink.perl, but I'm not doing that here. Obviously all of that fits in one script, but I think for something like this that's a one-off script with global variables it's much harder to follow when a large part of your script is some if/else or keeping/resetting of state simply to work around the script doing two things instead of one. Especially because in this case this script wants to process the file as one big string, but lint-gitlink.perl wants to look at it one line at a time. We could also consolidate this whole thing and t/check-non-portable-shell.pl, but that one likes to join lines as part of its shell parsing. So let's just add another script, whole scaffolding is basically: use strict; use warnings; sub report { ... } my $code = 0; while (<>) { ... } exit $code; We'd spend more lines effort trying to consolidate them than just copying that around. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2021-01-04doc: fix some typosThomas Ackermann1-1/+1
Signed-off-by: Thomas Ackermann <th.acker@arcor.de> Acked-by: Martin Ågren <martin.agren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-11-05doc: fixing two trivial typos in Documentation/Marlon Rac Cambasis1-1/+1
Fix misspelled "specified" and "occurred" in documentation and comments. Signed-off-by: Marlon Rac Cambasis <marlonrc08@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-02-14git-p4: add p4 submit hooksBen Keene1-0/+35
The git command "commit" supports a number of hooks that support changing the behavior of the commit command. The git-p4.py program only has one existing hook, "p4-pre-submit". This command occurs early in the process. There are no hooks in the process flow for modifying the P4 changelist text programmatically. Adds 3 new hooks to git-p4.py to the submit option. The new hooks are: * p4-prepare-changelist - Execute this hook after the changelist file has been created. The hook will be executed even if the --prepare-p4-only option is set. This hook ignores the --no-verify option in keeping with the existing behavior of git commit. * p4-changelist - Execute this hook after the user has edited the changelist. Do not execute this hook if the user has selected the --prepare-p4-only option. This hook will honor the --no-verify, following the conventions of git commit. * p4-post-changelist - Execute this hook after the P4 submission process has completed successfully. This hook takes no parameters and is executed regardless of the --no-verify option. It's return value will not be checked. The calls to the new hooks: p4-prepare-changelist, p4-changelist, and p4-post-changelist should all be called inside the try-finally block. Signed-off-by: Ben Keene <seraphire@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-02-11git-p4: add --no-verify optionBen Keene1-2/+8
Add new command line option --no-verify: Add a new command line option "--no-verify" to the Submit command of git-p4.py. This option will function in the spirit of the existing --no-verify command line option found in git commit. It will cause the P4 Submit function to ignore the existing p4-pre-submit. Change the execution of the existing trigger p4-pre-submit to honor the --no-verify option. Before exiting on failure of this hook, display text to the user explaining which hook has failed and the impact of using the --no-verify option. Change the call of the p4-pre-submit hook to use the new run_git_hook function. This is in preparation of additional hooks to be added. Signed-off-by: Ben Keene <seraphire@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-01-23doc: tidy asciidoc styleJean-Noël Avila1-4/+4
This mainly refers to enforcing indentation on additional lines of items of lists. Signed-off-by: Jean-Noël Avila <jn.avila@free.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-10-16git-p4: fully support unshelving changelistsLuke Diamand1-2/+2
The previous git-p4 unshelve support would check for changes in Perforce to the files being unshelved since the original shelve, and would complain if any were found. This was to ensure that the user wouldn't end up with both the shelved change delta, and some deltas from other changes in their git commit. e.g. given fileA: the quick brown fox change1: s/the/The/ <- p4 shelve this change change2: s/fox/Fox/ <- p4 submit this change git p4 unshelve 1 <- FAIL This change teaches the P4Unshelve class to always create a parent commit which matches the P4 tree (for the files being unshelved) at the point prior to the P4 shelve being created (which is reported in the p4 description for a shelved changelist). That then means git-p4 can always create a git commit matching the P4 shelve that was originally created, without any extra deltas. The user might still need to use the --origin option though - there is no way for git-p4 to work out the versions of all of the other *unchanged* files in the shelve, since this information is not recorded by Perforce. Additionally this fixes handling of shelved 'move' operations. Signed-off-by: Luke Diamand <luke@diamand.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-10-16git-p4: unshelve into refs/remotes/p4-unshelved, not refs/remotes/p4/unshelvedLuke Diamand1-3/+3
The branch detection code looks for branches under refs/remotes/p4/... and can end up getting confused if there are unshelved changes in there as well. This happens in the function p4BranchesInGit(). Instead, put the unshelved changes into refs/remotes/p4-unshelved/<N>. Signed-off-by: Luke Diamand <luke@diamand.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-08-01git-p4: add the `p4-pre-submit` hookChen Bin1-0/+8
The `p4-pre-submit` hook is executed before git-p4 submits code. If the hook exits with non-zero value, submit process not start. Signed-off-by: Chen Bin <chenbin.sh@gmail.com> Reviewed-by: Luke Diamand <luke@diamand.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-06-18Merge branch 'ld/git-p4-updates'Junio C Hamano1-0/+25
"git p4" updates. * ld/git-p4-updates: git-p4: auto-size the block git-p4: narrow the scope of exceptions caught when parsing an int git-p4: raise exceptions from p4CmdList based on error from p4 server git-p4: better error reporting when p4 fails git-p4: add option to disable syncing of p4/master with p4 git-p4: disable-rebase: allow setting this via configuration git-p4: add options --commit and --disable-rebase
2018-06-12git-p4: add option to disable syncing of p4/master with p4Luke Diamand1-0/+8
Add an option to the git-p4 submit command to disable syncing with Perforce. This is useful for the case where a git-p4 mirror has been setup on a server somewhere, running from (e.g.) cron, and developers then clone from this. Having the local cloned copy also sync from Perforce just isn't useful. Signed-off-by: Luke Diamand <luke@diamand.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-06-12git-p4: disable-rebase: allow setting this via configurationLuke Diamand1-1/+4
This just lets you set the --disable-rebase option with the git configuration options git-p4.disableRebase. If you're using this option, you probably want to set it all the time for a given repo. Signed-off-by: Luke Diamand <luke@diamand.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-06-12git-p4: add options --commit and --disable-rebaseRomain Merland1-0/+14
On a daily work with multiple local git branches, the usual way to submit only a specified commit was to cherry-pick the commit on master then run git-p4 submit. It can be very annoying to switch between local branches and master, only to submit one commit. The proposed new way is to select directly the commit you want to submit. Add option --commit to command 'git-p4 submit' in order to submit only specified commit(s) in p4. On a daily work developping software with big compilation time, one may not want to rebase on his local git tree, in order to avoid long recompilation. Add option --disable-rebase to command 'git-p4 submit' in order to disable rebase after submission. Thanks-to: Cedric Borgese <cedric.borgese@gmail.com> Reviewed-by: Luke Diamand <luke@diamand.org> Signed-off-by: Romain Merland <merlorom@yahoo.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-06-04Merge branch 'rd/p4-doc-markup-env'Junio C Hamano1-5/+5
Doc markup update. * rd/p4-doc-markup-env: p4.txt: Use backquotes for variable names
2018-06-01Merge branch 'ld/p4-unshelve'Junio C Hamano1-0/+32
"git p4" learned to "unshelve" shelved commit from P4. * ld/p4-unshelve: git-p4: add unshelve command
2018-06-01p4.txt: Use backquotes for variable namesRobert P. J. Day1-5/+5
For consistency, use backquotes when referring to environment variables, as is done in other man pages. Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-05-24git-p4: add unshelve commandLuke Diamand1-0/+32
This can be used to "unshelve" a shelved P4 commit into a git commit. For example: $ git p4 unshelve 12345 The resulting commit ends up in the branch: refs/remotes/p4/unshelved/12345 If that branch already exists, it is renamed - for example the above branch would be saved as p4/unshelved/12345.1. git-p4 checks that the shelved changelist is based on files which are at the same Perforce revision as the origin branch being used for the unshelve (HEAD by default). If they are not, it will refuse to unshelve. This is to ensure that the unshelved change does not contain other changes mixed-in. The reference branch can be changed manually with the "--origin" option. The change adds a new Unshelve command class. This just runs the existing P4Sync code tweaked to handle a shelved changelist. Signed-off-by: Luke Diamand <luke@diamand.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-05-02doc: keep first level section header in upper caseNguyễn Thái Ngọc Duy1-2/+2
When formatted as a man page, 1st section header is always in upper case even if we write it otherwise. Make all 1st section headers uppercase to keep it close to the final output. This does affect html since case is kept there, but I still think it's a good idea to maintain a consistent style for 1st section headers. Some sections perhaps should become second sections instead, where case is kept, and for better organization. I will update if anyone has suggestions about this. While at there I also make some header more consistent (e.g. examples vs example) and fix a couple minor things here and there. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-12-22git-p4: update multiple shelved change listsLuke Diamand1-1/+7
--update-shelve can now be specified multiple times on the command-line, to update multiple shelved changelists in a single submit. This then means that a git patch series can be mirrored to a sequence of shelved changelists, and (relatively easily) kept in sync as changes are made in git. Note that Perforce does not really support overlapping shelved changelists where one change touches the files modified by another. Trying to do this will result in merge conflicts. Signed-off-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 Hamano1-0/+2
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
2016-12-29git-p4: do not pass '-r 0' to p4 commandsIgor Kushnir1-0/+2
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-16Merge branch 'ls/p4-retry-thrice'Junio C Hamano1-0/+4
* ls/p4-retry-thrice: git-p4: add config to retry p4 commands; retry 3 times by default
2016-12-05git-p4: add config to retry p4 commands; retry 3 times by defaultLars Schneider1-0/+4
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 Diamand1-0/+4
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 Kursancew1-0/+5
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-07-28Merge branch 'mm/doc-tt' into maintJunio C Hamano1-11/+11
More mark-up updates to typeset strings that are expected to literally typed by the end user in fixed-width font. * mm/doc-tt: doc: typeset HEAD and variants as literal CodingGuidelines: formatting HEAD in documentation doc: typeset long options with argument as literal doc: typeset '--' as literal doc: typeset long command-line options as literal doc: typeset short command-line options as literal Documentation/git-mv.txt: fix whitespace indentation
2016-07-13Merge branch 'mm/doc-tt'Junio C Hamano1-11/+11
More mark-up updates to typeset strings that are expected to literally typed by the end user in fixed-width font. * mm/doc-tt: doc: typeset HEAD and variants as literal CodingGuidelines: formatting HEAD in documentation doc: typeset long options with argument as literal doc: typeset '--' as literal doc: typeset long command-line options as literal doc: typeset short command-line options as literal Documentation/git-mv.txt: fix whitespace indentation
2016-07-06Merge branch 'tr/doc-tt' into maintJunio C Hamano1-2/+2
The documentation set has been updated so that literal commands, configuration variables and environment variables are consistently typeset in fixed-width font and bold in manpages. * tr/doc-tt: doc: change configuration variables format doc: more consistency in environment variables format doc: change environment variables format doc: clearer rule about formatting literals
2016-06-28doc: typeset HEAD and variants as literalMatthieu Moy1-1/+1
This is an application of the newly added CodingGuidelines to HEAD and variants like FETCH_HEAD. It was obtained with: perl -pi -e "s/'([A-Z_]*HEAD)'/\`\$1\`/g" *.txt Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-06-28doc: typeset long command-line options as literalMatthieu Moy1-10/+10
Similarly to the previous commit, use backquotes instead of forward-quotes, for long options. This was obtained with: perl -pi -e "s/'(--[a-z][a-z=<>-]*)'/\`\$1\`/g" *.txt and manual tweak to remove false positive in ascii-art (o'--o'--o' to describe rewritten history). Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-06-27Merge branch 'tr/doc-tt'Junio C Hamano1-2/+2
The documentation set has been updated so that literal commands, configuration variables and environment variables are consistently typeset in fixed-width font and bold in manpages. * tr/doc-tt: doc: change configuration variables format doc: more consistency in environment variables format doc: change environment variables format doc: clearer rule about formatting literals
2016-06-08doc: more consistency in environment variables formatTom Russello1-1/+1
Wrap with backticks (monospaced font) unwrapped or single-quotes wrapped (italic type) environment variables which are followed by the word "environment". It was obtained with: perl -pi -e "s/\'?(\\\$?[0-9A-Z\_]+)\'?(?= environment ?)/\`\1\`/g" *.txt One of the main purposes is to stick to the CodingGuidelines as possible so that people writting new documentation by mimicking the existing are more likely to have it right (even if they didn't read the CodingGuidelines). Signed-off-by: Tom Russello <tom.russello@grenoble-inp.org> Signed-off-by: Erwan Mathoniere <erwan.mathoniere@grenoble-inp.org> Signed-off-by: Samuel Groot <samuel.groot@grenoble-inp.org> Signed-off-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr> Reviewed-by: Matthieu Moy <Matthieu.Moy@imag.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-06-08doc: change environment variables formatTom Russello1-1/+1
This change GIT_* variables that where in italic style to monospaced font according to the guideline. It was obtained with perl -pi -e "s/\'(GIT_.*?)\'/\`\1\`/g" *.txt One of the main purposes is to stick to the CodingGuidelines as possible so that people writting new documentation by mimicking the existing are more likely to have it right (even if they didn't read the CodingGuidelines). Signed-off-by: Tom Russello <tom.russello@grenoble-inp.org> Signed-off-by: Erwan Mathoniere <erwan.mathoniere@grenoble-inp.org> Signed-off-by: Samuel Groot <samuel.groot@grenoble-inp.org> Signed-off-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr> Reviewed-by: Matthieu Moy <Matthieu.Moy@imag.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-04-06Merge branch 'ls/p4-map-user'Junio C Hamano1-0/+11
"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-23Documentation: fix git-p4 AsciiDoc formattingLars Schneider1-5/+3
Noticed-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Lars Schneider <larsxschneider@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-03-21Documentation: use ASCII quotation marks in git-p4Lars Schneider1-1/+1
Signed-off-by: Lars Schneider <larsxschneider@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-03-15git-p4: map a P4 user to Git author name and email addressLars Schneider1-0/+11
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>
2015-12-15Merge branch 'ls/p4-keep-empty-commits'Junio C Hamano1-0/+4
"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 Schneider1-0/+4
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-10-15Merge branch 'ls/p4-lfs'Junio C Hamano1-0/+32
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
2015-10-03git-p4: add support for large file systemsLars Schneider1-0/+32
Perforce repositories can contain large (binary) files. Migrating these repositories to Git generates very large local clones. External storage systems such as Git LFS [1], Git Fat [2], Git Media [3], git-annex [4] try to address this problem. Add a generic mechanism to detect large files based on extension, uncompressed size, and/or compressed size. [1] https://git-lfs.github.com/ [2] https://github.com/jedbrown/git-fat [3] https://github.com/alebedev/git-media [4] https://git-annex.branchable.com/ Signed-off-by: Lars Schneider <larsxschneider@gmail.com> Conflicts: Documentation/git-p4.txt git-p4.py Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-09-03git-p4: add config git-p4.pathEncodingLars Schneider1-0/+7
Perforce keeps the encoding of a path as given by the originating OS. Git expects paths encoded as UTF-8. Add a config to tell git-p4 what encoding Perforce had used for the paths. This encoding is used to transcode the paths to UTF-8. As an example, Perforce on Windows often uses “cp1252” to encode path names. Signed-off-by: Lars Schneider <larsxschneider@gmail.com> Acked-by: Luke Diamand <luke@diamand.org> Signed-off-by: Lars Schneider <larsxschneider@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-04-20git-p4: use -m when running p4 changesLex Spoon1-3/+14
Simply running "p4 changes" on a large branch can result in a "too many rows scanned" error from the Perforce server. It is better to use a sequence of smaller calls to "p4 changes", using the "-m" option to limit the size of each call. Signed-off-by: Lex Spoon <lex@lexspoon.org> Acked-by: Luke Diamand <luke@diamand.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-02-11git-p4: support excluding paths on syncLuke Diamand1-3/+3
The clone subcommand has long had support for excluding subdirectories, but sync has not. This is a nuisance, since as soon as you do a sync, any changed files that were initially excluded start showing up. Move the "exclude" command-line option into the parent class; the actual behavior was already present there so it simply had to be exposed. Signed-off-by: Luke Diamand <luke@diamand.org> Reviewed-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-01-22git p4 doc: use two-line style for options with multiple spellingsPete Wyckoff1-2/+4
Thomas Rast noticed the docs have a mix of styles when it comes to options with multiple spellings. Standardize the couple in git-p4.txt that are odd. Instead of: -n, --dry-run:: Do this: -n:: --dry-run:: See http://thread.gmane.org/gmane.comp.version-control.git/219936/focus=219945 Signed-off-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-07-03Change "remote tracking" to "remote-tracking"Michael Schubert1-7/+10
Fix a typo ("remote remote-tracking") going back to the big cleanup in 2010 (8b3f3f84 etc). Also, remove some more occurrences of "tracking" and "remote tracking" in favor of "remote-tracking". Signed-off-by: Michael Schubert <mschub@elegosoft.com> Reviewed-by: Johan Herland <johan@herland.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-02-05Merge branch 'ta/doc-no-small-caps'Junio C Hamano1-42/+42
Update documentation to change "GIT" which was a poor-man's small caps to "Git". The latter was the intended spelling. Also change "git" spelled in all-lowercase to "Git" when it refers to the system as the whole or the concept it embodies, as opposed to the command the end users would type. * ta/doc-no-small-caps: Documentation: StGit is the right spelling, not StGIT Documentation: describe the "repository" in repository-layout Documentation: add a description for 'gitfile' to glossary Documentation: do not use undefined terms git-dir and git-file Documentation: the name of the system is 'Git', not 'git' Documentation: avoid poor-man's small caps GIT
2013-02-01Documentation: the name of the system is 'Git', not 'git'Thomas Ackermann1-42/+42
Signed-off-by: Thomas Ackermann <th.acker@arcor.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-01-15git p4: fix submit when no master branchPete Wyckoff1-0/+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>
2013-01-15git p4: fix sync --branch when no master branchPete Wyckoff1-0/+5
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>
2013-01-15git p4: allow short ref names to --branchPete Wyckoff1-2/+5
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>
2013-01-15git p4 doc: fix branch detection examplePete Wyckoff1-1/+3
Make sure that the example on how to use git-p4.branchList works if typed directly. In particular, it does not make sense to set a config variable until the git repository has been initialized. Reported-by: Olivier Delalleau <shish@keba.be> Signed-off-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-01-15git p4: clone --branch should checkout masterPete Wyckoff1-2/+1
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>
2012-09-16git-p4: add submit --conflict option and config varaiablePete Wyckoff1-0/+11
This allows specifying what to do when a conflict happens when applying a commit to p4, automating the interactive prompt. Signed-off-by: Pete Wyckoff <pw@padd.com> Acked-by: Luke Diamand <luke@diamand.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-16git p4: add submit --prepare-p4-only optionPete Wyckoff1-0/+7
This option can be used to prepare the client workspace for submission, only. It does not invoke the final "p4 submit". A message describes how to proceed, either submitting the changes or reverting. Signed-off-by: Pete Wyckoff <pw@padd.com> Acked-by: Luke Diamand <luke@diamand.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-16git p4: add submit --dry-run optionPete Wyckoff1-0/+4
A new option, "git p4 submit --dry-run" can be used to verify what commits and labels would be moved into p4. Signed-off-by: Pete Wyckoff <pw@padd.com> Acked-by: Luke Diamand <luke@diamand.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-09-16git p4: accept -v for --verbosePete Wyckoff1-1/+1
The short form "-v" is common in many git commands as an alias for "--verbose". Signed-off-by: Pete Wyckoff <pw@padd.com> Acked-by: Luke Diamand <luke@diamand.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-07-05git p4: refactor diffOpts calculationGary Gibbons1-4/+6
P4Submit.applyCommit() To avoid recalculating the same diffOpts for each commit, move it out of applyCommit() and into the top-level run(). Also fix a bug in that code which interpreted the value of detectRenames as a string rather than as a boolean. [pw: fix documentation, rearrange code a bit] Signed-off-by: Gary Gibbons <ggibbons@perforce.com> Signed-off-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-07Sync with maintJunio C Hamano1-2/+3
2012-05-07git p4 doc: fix formattingPete Wyckoff1-1/+3
Attach example sections to previous level of indenting. Fix a trailing :: Signed-off-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-04-24git p4: move verbose to base classLuke Diamand1-7/+4
The verbose flag is common to all classes, or at least should be. Make it a member of the base Command class, rather than reimplementing for each class. Make option parsing mirror this. Signed-off-by: Luke Diamand <luke@diamand.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-04-24git p4: fix-up "import/export of labels to/from p4"Luke Diamand1-10/+10
The previous one is already in 'next' but was somewhat lacking. The configuration "git-p4.validLabelRegexp" is now called "labelExportRegexp", and its default covers lowercase alphabets as well. Signed-off-by: Luke Diamand <luke@diamand.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-04-11git p4: import/export of labels to/from p4Luke Diamand1-5/+38
The existing label import code looks at each commit being imported, and then checks for labels at that commit. This doesn't work in the real world though because it will drop labels applied on changelists that have already been imported, a common pattern. This change adds a new --import-labels option. With this option, at the end of the sync, git p4 gets sets of labels in p4 and git, and then creates a git tag for each missing p4 label. This means that tags created on older changelists are still imported. Tags that could not be imported are added to an ignore list. The same sets of git and p4 tags and labels can also be used to derive a list of git tags to export to p4. This is enabled with --export-labels in 'git p4 submit'. Signed-off-by: Luke Diamand <luke@diamand.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-04-09git-p4: move to toplevelPete Wyckoff1-13/+6
Move git-p4 out of contrib/fast-import into the main code base, aside other foreign SCM tools. Signed-off-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-02-26Merge branch 'maint'Junio C Hamano1-3/+7
* maint: Document accumulated fixes since 1.7.9.2 Git 1.7.8.5 grep -P: Fix matching ^ and $ am: don't infloop for an empty input file rebase -m: only call "notes copy" when rewritten exists and is non-empty git-p4: remove bash-ism in t9800 git-p4: remove bash-ism in t9809 git-p4: fix submit regression with clientSpec and subdir clone git-p4: set useClientSpec variable on initial clone Makefile: add thread-utils.h to LIB_H Conflicts: RelNotes t/t9809-git-p4-client-view.sh
2012-02-26git-p4: set useClientSpec variable on initial clonePete Wyckoff1-3/+7
If --use-client-spec was given, set the matching configuration variable. This is necessary to ensure that future submits work properly. The alternatives of requiring the user to set it, or providing a command-line option on every submit, are error prone. Signed-off-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-02-23git-p4: add initial support for RCS keywordsLuke Diamand1-0/+5
RCS keywords cause problems for git-p4 as perforce always expands them (if +k is set) and so when applying the patch, git reports that the files have been modified by both sides, when in fact they haven't. This change means that when git-p4 detects a problem applying a patch, it will check to see if keyword expansion could be the culprit. If it is, it strips the keywords in the p4 repository so that they match what git is expecting. It then has another go at applying the patch. This behaviour is enabled with a new git-p4 configuration option and is off by default. Acked-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Luke Diamand <luke@diamand.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-01-11git-p4: add tests demonstrating spec overlay ambiguitiesPete Wyckoff1-0/+5
Introduce new tests that look more closely at overlay situations when there are conflicting files. Five of these are broken. Document the brokenness. This is a fundamental problem with how git-p4 only "borrows" a client spec. At some sync operation, a new change can contain a file which is already in the repo or explicitly deleted through another mapping. To sort this out would involve listing all the files in the client spec to find one with a higher priority. While this is not too hard for the initial import, subsequent sync operations would be very costly. Signed-off-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-01-03git-p4: view spec documentationPete Wyckoff1-13/+27
Signed-off-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-12-27git-p4: document and test submit optionsPete Wyckoff1-2/+6
Clarify there is a -M option, but no -C. These are both configurable through variables. Explain that the allowSubmit variable takes a comma-separated list of branch names. Catch earlier an invalid branch name given as an argument to "git p4 clone". Test option --origin, variable allowSubmit, and explicit master branch name. Signed-off-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-12-27git-p4: test and document --use-client-specPete Wyckoff1-1/+4
The depot path is required, even with this option. Make sure git-p4 fails and exits with non-zero. Contents in the specified depot path will be rearranged according to the client spec. Test this and add a note in the docs. Leave an XXX suggesting that this is somewhat confusing behavior that might be good to fix later. Function stripRepoPath() looks at self.useClientSpec. Make sure this is set both for command-line option --use-client-spec and for configuration variable git-p4.useClientSpec. Test this. Signed-off-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-12-27git-p4: document and test --import-localPete Wyckoff1-1/+3
Explain that it is needed on future syncs to find p4 branches in refs/heads. Test this behavior. Signed-off-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-12-27git-p4: document and test clone --branchPete Wyckoff1-1/+9
Clone with --branch will not checkout HEAD, unless the branch happens to be called the default refs/remotes/p4/master. The --branch option is most useful with sync; give an example of that. Signed-off-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-12-27git-p4: test cloning with two dirs, clarify docPete Wyckoff1-2/+9
Document how git-p4 currently works when specifying multiple depot paths: 1. No branches or directories are named. 2. Conflicting files are silently ignored---the last change wins. 2. Option --destination is required, else the last path is construed to be a directory. 3. Revision specifiers must be the same on all paths for them to take effect. Test this behavior. Signed-off-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-12-27git-p4: introduce asciidoc documentationPete Wyckoff1-0/+455
Add proper documentation for git-p4. Delete the old .txt documentation from contrib/fast-import. Cc: Frans Klaver <fransklaver@gmail.com> Cc: Luke Diamand <luke@diamand.org> Signed-off-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>