Skip to contentSkip to conversation

git-p4: view spec review fixes

PATCH New Pete Wyckoff 1 participant 6 messages Jun 15, 2016 Documentation

lore
Share & tools
lore
#0 lore raw

cover git-p4: view spec review fixes

I received some helpful review comments offline regarding the series recently merged into master (8cbfc11
(Merge branch 'pw/p4-view-updates', 2012-01-06)).

It would be nice to see these go into 1.7.9 as well. Even though they belong there logically, they are minor fixes, and not critical.

I added a bunch of new tests documenting further problems, but will not fix those here as the changes will be more invasive.

Thanks,

Pete Wyckoff (5):
git-p4: only a single ... wildcard is supported
git-p4: fix verbose comment typo
git-p4: clarify comment
git-p4: adjust test to adhere to stricter useClientSpec
git-p4: add tests demonstrating spec overlay ambiguities

 Documentation/git-p4.txt      |    5 +
 contrib/fast-import/git-p4    |    9 +-
 t/t9806-git-p4-options.sh     |    4 +-
 t/t9809-git-p4-client-view.sh |  395 ++++++++++++++++++++++++++++++++++++++++-
 4 files changed, 406 insertions(+), 7 deletions(-)
Signature · 1 line
1.7.8.1.409.g3e338.dirty
#1 lore raw

PATCH 1/5 git-p4: only a single ... wildcard is supported

Catch the case where a ... exists at the end, and also elsehwere.

---
 contrib/fast-import/git-p4    |    4 ++--
 t/t9809-git-p4-client-view.sh |    8 +++++++-
 2 files changed, 9 insertions(+), 3 deletions(-)
contrib/fast-import/git-p4 +2 -2
index 3e1aa27..20208bf 100755
@@ -1207,8 +1207,8 @@ class View(object):
                 die("Can't handle * wildcards in view: %s" % self.path)
             triple_dot_index = self.path.find("...")
             if triple_dot_index >= 0:
-                if not self.path.endswith("..."):
-                    die("Can handle ... wildcard only at end of path: %s" %
+                if triple_dot_index != len(self.path) - 3:
+                    die("Can handle only single ... wildcard, at end: %s" %
                         self.path)
                 self.ends_triple_dot = True
 
t/t9809-git-p4-client-view.sh +7 -1
index c9471d5..54204af 100755
@@ -101,12 +101,18 @@ test_expect_success 'unsupported view wildcard *' '
 	test_must_fail "$GITP4" clone --use-client-spec --dest="$git" //depot
 '
 
-test_expect_success 'wildcard ... only supported at end of spec' '
+test_expect_success 'wildcard ... only supported at end of spec 1' '
 	client_view "//depot/.../file11 //client/.../file11" &&
 	test_when_finished cleanup_git &&
 	test_must_fail "$GITP4" clone --use-client-spec --dest="$git" //depot
 '
 
+test_expect_success 'wildcard ... only supported at end of spec 2' '
+	client_view "//depot/.../a/... //client/.../a/..." &&
+	test_when_finished cleanup_git &&
+	test_must_fail "$GITP4" clone --use-client-spec --dest="$git" //depot
+'
+
 test_expect_success 'basic map' '
 	client_view "//depot/dir1/... //client/cli1/..." &&
 	files="cli1/file11 cli1/file12" &&
Signature · 1 line
1.7.8.1.409.g3e338.dirty
#2 lore raw

PATCH 2/5 git-p4: fix verbose comment typo

In reply to Pete Wyckoff
---
 contrib/fast-import/git-p4 |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
contrib/fast-import/git-p4 +1 -1
index 20208bf..e267f31 100755
@@ -1263,7 +1263,7 @@ class View(object):
             if self.exclude:
                 c = "-"
             return "View.Mapping: %s%s -> %s" % \
-                   (c, self.depot_side, self.client_side)
+                   (c, self.depot_side.path, self.client_side.path)
 
         def map_depot_to_client(self, depot_path):
             """Calculate the client path if using this mapping on the
Signature · 1 line
1.7.8.1.409.g3e338.dirty
#3 lore raw

PATCH 3/5 git-p4: clarify comment

In reply to Pete Wyckoff
---
 contrib/fast-import/git-p4 |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
contrib/fast-import/git-p4 +2 -1
index e267f31..e11e15b 100755
@@ -1363,7 +1363,8 @@ class View(object):
             else:
                 # This mapping matched; no need to search any further.
                 # But, the mapping could be rejected if the client path
-                # has already been claimed by an earlier mapping.
+                # has already been claimed by an earlier mapping (i.e.
+                # one later in the list, which we are walking backwards).
                 already_mapped_in_client = False
                 for f in paths_filled:
                     # this is View.Path.match
Signature · 1 line
1.7.8.1.409.g3e338.dirty
#4 lore raw

PATCH 4/5 git-p4: adjust test to adhere to stricter useClientSpec

In reply to Pete Wyckoff

This test relied on what now is seen as broken behavior in --use-client-spec. Change it to make sure it works according to the new behavior as described in ecb7cf9 (git-p4: rewrite view handling, 2012-01-02) and c700b68 (git-p4: test client view handling, 2012-01-02).

---
 t/t9806-git-p4-options.sh |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
t/t9806-git-p4-options.sh +2 -2
index 1f1952a..0571602 100755
@@ -146,7 +146,7 @@ test_expect_success 'clone --use-client-spec' '
 	(
 		cd "$git" &&
 		test_path_is_file bus/dir/f4 &&
-		test_path_is_file file1
+		test_path_is_missing file1
 	) &&
 	cleanup_git &&
 
@@ -159,7 +159,7 @@ test_expect_success 'clone --use-client-spec' '
 		"$GITP4" sync //depot/... &&
 		git checkout -b master p4/master &&
 		test_path_is_file bus/dir/f4 &&
-		test_path_is_file file1
+		test_path_is_missing file1
 	)
 '
 
Signature · 1 line
1.7.8.1.409.g3e338.dirty
#5 lore raw

PATCH 5/5 git-p4: add tests demonstrating spec overlay ambiguities

In reply to Pete Wyckoff

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.

---
 Documentation/git-p4.txt      |    5 +
 t/t9809-git-p4-client-view.sh |  387 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 392 insertions(+), 0 deletions(-)
Documentation/git-p4.txt +5 -0
index 78938b2..8b92cc0 100644
@@ -314,6 +314,11 @@ around whitespace.  Of the possible wildcards, git-p4 only handles
 '...', and only when it is at the end of the path.  Git-p4 will complain
 if it encounters an unhandled wildcard.
 
+Bugs in the implementation of overlap mappings exist.  If multiple depot
+paths map through overlays to the same location in the repository,
+git-p4 can choose the wrong one.  This is hard to solve without
+dedicating a client spec just for git-p4.
+
 The name of the client can be given to git-p4 in multiple ways.  The
 variable 'git-p4.client' takes precedence if it exists.  Otherwise,
 normal p4 mechanisms of determining the client are used:  environment
t/t9809-git-p4-client-view.sh +387 -0

393 lines not on this page · raw message

Signature · 1 line
1.7.8.1.409.g3e338.dirty