git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] git-p4: Improve client path detection when branches are used

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 19, 2015, 00:58 UTC
Message-ID
<xmqqk2x9ndcs.fsf@gitster.dls.corp.google.com>
In-Reply-To
<1429399445-11024-1-git-send-email-vitor.hda@gmail.com>
Vitor Antunes <vitor.hda@gmail.com> writes:
Show 6 quoted lines
> This patch makes the client path detection more robust by limiting the valid
> results from p4 where. The test case is also made more complex, to guarantee
> that such client views are supported.
>
> Signed-off-by: Vitor Antunes <vitor.hda@gmail.com>
> ---

Was this designed to be squashed into the previous 2/2 patch? I do not think either 1/2 or 2/2 is in 'next' yet, and if this was to correct mistakes in the 2/2 that was posted earlier, it would be nicer to have a replacement patch with corrected log message.

Thanks.
Show 74 quoted lines
>  git-p4.py                |    4 +++-
>  t/t9801-git-p4-branch.sh |   12 ++++++++++--
>  2 files changed, 13 insertions(+), 3 deletions(-)
>
> diff --git a/git-p4.py b/git-p4.py
> index 262a95b..28d0d90 100755
> --- a/git-p4.py
> +++ b/git-p4.py
> @@ -507,7 +507,9 @@ def p4Where(depotPath):
>      output = None
>      for entry in outputList:
>          if "depotFile" in entry:
> -            if entry["depotFile"].find(depotPath) >= 0:
> +            # Search for the base client side depot path, as long as it starts with the branch's P4 path.
> +            # The base path always ends with "/...".
> +            if entry["depotFile"].find(depotPath) == 0 and entry["depotFile"][-4:] == "/...":
>                  output = entry
>                  break
>          elif "data" in entry:
> diff --git a/t/t9801-git-p4-branch.sh b/t/t9801-git-p4-branch.sh
> index 4fe4e18..0aafd03 100755
> --- a/t/t9801-git-p4-branch.sh
> +++ b/t/t9801-git-p4-branch.sh
> @@ -512,23 +512,28 @@ test_expect_success 'restart p4d' '
>  #
>  # 1: //depot/branch1/base/file1
>  #    //depot/branch1/base/file2
> +#    //depot/branch1/base/dir/sub_file1
>  # 2: integrate //depot/branch1/base/... -> //depot/branch2/base/...
>  # 3: //depot/branch1/base/file3
>  # 4: //depot/branch1/base/file2 (edit)
>  # 5: integrate //depot/branch1/base/... -> //depot/branch3/base/...
>  #
> -# Note: the client view remove the "base" folder from the workspace
> +# Note: the client view removes the "base" folder from the workspace
> +#       and moves sub_file1 one level up.
>  test_expect_success 'add simple p4 branches with common base folder on each branch' '
>  	(
>  		cd "$cli" &&
>  		client_view "//depot/branch1/base/... //client/branch1/..." \
> +			    "//depot/branch1/base/dir/sub_file1 //client/branch1/sub_file1" \
>  			    "//depot/branch2/base/... //client/branch2/..." \
>  			    "//depot/branch3/base/... //client/branch3/..." &&
>  		mkdir -p branch1 &&
>  		cd branch1 &&
>  		echo file1 >file1 &&
>  		echo file2 >file2 &&
> -		p4 add file1 file2 &&
> +		mkdir dir &&
> +		echo sub_file1 >sub_file1 &&
> +		p4 add file1 file2 sub_file1 &&
>  		p4 submit -d "Create branch1" &&
>  		p4 integrate //depot/branch1/base/... //depot/branch2/base/... &&
>  		p4 submit -d "Integrate branch2 from branch1" &&
> @@ -561,16 +566,19 @@ test_expect_success 'git p4 clone simple branches with base folder on server sid
>  		test -f file1 &&
>  		test -f file2 &&
>  		test -f file3 &&
> +		test -f sub_file1 &&
>  		grep update file2 &&
>  		git reset --hard p4/depot/branch2 &&
>  		test -f file1 &&
>  		test -f file2 &&
>  		test ! -f file3 &&
> +		test -f sub_file1 &&
>  		! grep update file2 &&
>  		git reset --hard p4/depot/branch3 &&
>  		test -f file1 &&
>  		test -f file2 &&
>  		test -f file3 &&
> +		test -f sub_file1 &&
>  		grep update file2 &&
>  		cd "$cli" &&
>  		cd branch1 &&
Previous: Vitor AntunesNext: Vitor Antunes
Message 16 of 18 in “git-p4: Improve client path detection”
  1. 0/2 git-p4: Improve client path detectionVitor Antunes, Mar 28, 2015
  2. 1/2 git-p4: Check branch detection and client view togetherVitor Antunes, Mar 28, 2015
  3. 2/2 git-p4: Improve client path detection when branches are usedVitor Antunes, Mar 28, 2015
  4. t9814: Guarantee only one source exists in git-p4 copy testsVitor Antunes, Mar 29, 2015
  5. Junio C HamanoMar 30, 2015
  6. Luke DiamandMar 31, 2015
  7. t9814: Guarantee only one source exists in git-p4 copy testsVitor Antunes, Mar 31, 2015
  8. Luke DiamandApr 4, 2015
  9. Junio C HamanoApr 4, 2015
  10. t9814: Guarantee only one source exists in git-p4 copy testsVitor Antunes, Apr 5, 2015
  11. Luke DiamandApr 5, 2015
  12. Vitor AntunesApr 5, 2015
  13. Junio C HamanoApr 13, 2015
  14. Vitor AntunesApr 18, 2015
  15. git-p4: Improve client path detection when branches are usedVitor Antunes, Apr 18, 2015
  16. Junio C HamanoApr 19, 2015
  17. Vitor AntunesApr 19, 2015
  18. Junio C HamanoApr 20, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.