Perforce "p4 sync" not working properly

8.3k views Asked by At

Totally confused with the strange behavior of "p4 sync". Tried running the following commands

Note: The filename is not present in workspace

p4 sync //depot/filename --- shows that files are up-to-date

p4 have //depot/filename --- shows files not on client

Thought may be the perforce server thinks the file is present in its client's have database. So deleted the file using

p4 sync //depot/filename#none --- shows files up-to-date

p4 sync //depot/filename#head --- shows files up-to-date

Finally when I say

p4 have //depot/filename --- shows files not on client

Then I did

p4 sync -f //depot/filename#head --- shows //depot/filename - deleted as c:/workspace/filename

and in the end

p4 have //depot/filename --- shows file not on client.

Any idea what could be the issue here?

1

There are 1 answers

1
Samwise On BEST ANSWER

Run "p4 files //depot/filename" and you will see that it is a deleted file.

If an older version of the file were present on your client (i.e. "p4 have" said there was something there), "p4 sync" would remove it. Since the file is already not present on your client, you are already "up to date".

Running "p4 sync -f" forces the issue and attempts to delete the local file even though the have table says nothing is there. (If you'd added a brand new file in its place and hadn't done "p4 add" yet, that file is now lost forever -- be careful when using "p4 sync -f"!)