Commit e6388994 authored by Junio C Hamano's avatar Junio C Hamano

Merge branch 'ld/git-p4-updates'

"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
parents d676cc51 3deed5e0
......@@ -149,6 +149,12 @@ To specify a branch other than the current one, use:
$ git p4 submit topicbranch
------------
To specify a single commit or a range of commits, use:
------------
$ git p4 submit --commit <sha1>
$ git p4 submit --commit <sha1..sha1>
------------
The upstream reference is generally 'refs/remotes/p4/master', but can
be overridden using the `--origin=` command-line option.
......@@ -355,6 +361,19 @@ These options can be used to modify 'git p4 submit' behavior.
p4/master. See the "Sync options" section above for more
information.
--commit <sha1>|<sha1..sha1>::
Submit only the specified commit or range of commits, instead of the full
list of changes that are in the current Git branch.
--disable-rebase::
Disable the automatic rebase after all commits have been successfully
submitted. Can also be set with git-p4.disableRebase.
--disable-p4sync::
Disable the automatic sync of p4/master from Perforce after commits have
been submitted. Implies --disable-rebase. Can also be set with
git-p4.disableP4Sync. Sync with origin/master still goes ahead if possible.
Rebase options
~~~~~~~~~~~~~~
These options can be used to modify 'git p4 rebase' behavior.
......@@ -676,6 +695,12 @@ git-p4.conflict::
Specify submit behavior when a conflict with p4 is found, as per
--conflict. The default behavior is 'ask'.
git-p4.disableRebase::
Do not rebase the tree against p4/master following a submit.
git-p4.disableP4Sync::
Do not sync p4/master with Perforce following a submit. Implies git-p4.disableRebase.
IMPLEMENTATION DETAILS
----------------------
* Changesets from p4 are imported using Git fast-import.
......
This diff is collapsed.
......@@ -155,6 +155,46 @@ test_expect_success 'allow submit from branch with same revision but different n
)
'
# make two commits, but tell it to apply only one
test_expect_success 'submit --commit one' '
test_when_finished cleanup_git &&
git p4 clone --dest="$git" //depot &&
(
cd "$git" &&
test_commit "file9" &&
test_commit "file10" &&
git config git-p4.skipSubmitEdit true &&
git p4 submit --commit HEAD
) &&
(
cd "$cli" &&
test_path_is_missing "file9.t" &&
test_path_is_file "file10.t"
)
'
# make three commits, but tell it to apply only range
test_expect_success 'submit --commit range' '
test_when_finished cleanup_git &&
git p4 clone --dest="$git" //depot &&
(
cd "$git" &&
test_commit "file11" &&
test_commit "file12" &&
test_commit "file13" &&
git config git-p4.skipSubmitEdit true &&
git p4 submit --commit HEAD~2..HEAD
) &&
(
cd "$cli" &&
test_path_is_missing "file11.t" &&
test_path_is_file "file12.t" &&
test_path_is_file "file13.t"
)
'
#
# Basic submit tests, the five handled cases
#
......
......@@ -129,6 +129,7 @@ test_expect_success 'Create a repo with multiple depot paths' '
'
test_expect_success 'Clone repo with multiple depot paths' '
test_when_finished cleanup_git &&
(
cd "$git" &&
git p4 clone --changes-block-size=4 //depot/pathA@all //depot/pathB@all \
......@@ -138,6 +139,13 @@ test_expect_success 'Clone repo with multiple depot paths' '
)
'
test_expect_success 'Clone repo with self-sizing block size' '
test_when_finished cleanup_git &&
git p4 clone --changes-block-size=1000000 //depot@all --destination="$git" &&
git -C "$git" log --oneline >log &&
test_line_count \> 10 log
'
test_expect_success 'kill p4d' '
kill_p4d
'
......
#!/bin/sh
test_description='git p4 errors'
. ./lib-git-p4.sh
test_expect_success 'start p4d' '
start_p4d
'
test_expect_success 'add p4 files' '
(
cd "$cli" &&
echo file1 >file1 &&
p4 add file1 &&
p4 submit -d "file1"
)
'
# after this test, the default user requires a password
test_expect_success 'error handling' '
git p4 clone --dest="$git" //depot@all &&
(
cd "$git" &&
P4PORT=: test_must_fail git p4 submit 2>errmsg
) &&
p4 passwd -P newpassword &&
(
P4PASSWD=badpassword test_must_fail git p4 clone //depot/foo 2>errmsg &&
grep -q "failure accessing depot.*P4PASSWD" errmsg
)
'
test_expect_success 'ticket logged out' '
P4TICKETS="$cli/tickets" &&
echo "newpassword" | p4 login &&
(
cd "$git" &&
test_commit "ticket-auth-check" &&
p4 logout &&
test_must_fail git p4 submit 2>errmsg &&
grep -q "failure accessing depot" errmsg
)
'
test_expect_success 'create group with short ticket expiry' '
P4TICKETS="$cli/tickets" &&
echo "newpassword" | p4 login &&
p4_add_user short_expiry_user &&
p4 -u short_expiry_user passwd -P password &&
p4 group -i <<-EOF &&
Group: testgroup
Timeout: 3
Users: short_expiry_user
EOF
p4 users | grep short_expiry_user
'
test_expect_success 'git operation with expired ticket' '
P4TICKETS="$cli/tickets" &&
P4USER=short_expiry_user &&
echo "password" | p4 login &&
(
cd "$git" &&
git p4 sync &&
sleep 5 &&
test_must_fail git p4 sync 2>errmsg &&
grep "failure accessing depot" errmsg
)
'
test_expect_success 'kill p4d' '
kill_p4d
'
test_done
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment