Thread (6 messages) flat view 6 messages, 2 authors, 2016-06-15

Re: [PATCH 0/2] git-p4: Improve client path detection

From: Vitor Antunes <hidden>
Date: 2016-06-15 23:04:22

Luke Diamand [off-list ref] wrote on Sun, 05 Apr 2015 20:27:11 +0100
On 28/03/15 12:28, Vitor Antunes wrote:
quoted
I'm adding a test case for a scenario I was confronted with when using branch
detection and a client view specification. It is possible that the implemented
fix may not cover all possible scenarios, but there is no regression in the
available tests.
Vitor, one thing I wondered about with this part of the change:

-            if entry["depotFile"] == depotPath:
+            if entry["depotFile"].find(depotPath) >= 0:

Does this mean that if 'p4 where' produces multiple lines of output that
this will get confused, as it's just going to search for an instance of
depotPath.
The reason why I introduced that was because in the test case I implemented (and
which reflects a scenario I am confronted with in my workplace) the branches
have a base directory that is removed in the client view mapping.
As such, we will have a situation where depotPath is //depot/branch1/ while
runninng "p4 where" will result in //depot/branch1/base/. To overcome this I
used find() instead of a direct comparison. Now that I think about that, I could
probably have used the simpler `if depotPath in entry["depotFile"]`...
The example in the Perforce man page for 'p4 where' would trigger this
for example:

http://www.perforce.com/perforce/r14.2/manuals/cmdref/p4_where.html

-//a/b/file.txt //client/a/b/file.txt //home/user/root/a/b/file.txt
//a/b/file.txt //client/b/file.txt /home/user/root/b/file.txt
These are examples where a simple comparison as was implemented would work.
As an experiment, I hacked git-p4 to always use p4Where rather than
getClientRoot(), which I would have thought ought to work, but while
most of the tests passed, Pete's client-spec torture tests failed.
That was exactly my first approach and got to the same conclusion. I would have
investigated it further but since I haven't had much free time to invest in
solving this problem I decided to implement an intermediary solution that would
not introduce any regressions.

Vitor
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help