Discussion:
[p4] unable to re-sync after manually deleting files from workspace
M***@smsc.com
2005-06-15 15:52:18 UTC
Permalink
I've noticed that if files are manually removed from a workspace, that the perforce re-sync does not restore them from
the repository.

e.g.
rm my_file
p4 sync
my_file is NOT restored from the depot.

To get the file back, I need to go through P4 and remove a higher level of the hierarchy, then do a sync.

Is this a known issue?

Thanks,
Marco
Braucht, Jason
2005-06-15 17:12:19 UTC
Permalink
Marco,

I'm pretty sure this is an expected behavior. You really shouldn't manually manipulate files managed by Perforce. If you were trying to remove the file temporarily for testing or whatever, you could use the command 'p4 sync my_file#none'. If you wanted to delete the file, you should use the delete command 'p4 delete my_file'. In either case the result would be the same as 'rm my_file' except the files on disk remain consistent with what Perforce thinks are on disk. Of course if you simply sync to #none, the next time you perform a sync that file will magically reappear...

To put things back into a consistent state, you'll either need to do a 'p4 sync my_file#none' followed by 'p4 sync my_file' or 'p4 sync -f my_file' Alternatively there is a 'check consistency' option under File->More of the P4Win client (which I'm guessing you aren't using) that will detect that my_file is inconsistent with Perforce's DB and allow you to correct it.

Jason

-----Original Message-----
From: perforce-user-***@perforce.com
[mailto:perforce-user-***@perforce.com]On Behalf Of
***@smsc.com
Sent: Wednesday, June 15, 2005 10:52 AM
To: perforce-***@perforce.com
Subject: [p4] unable to re-sync after manually deleting files from
workspace


I've noticed that if files are manually removed from a workspace, that the perforce re-sync does not restore them from
the repository.

e.g.
rm my_file
p4 sync
my_file is NOT restored from the depot.

To get the file back, I need to go through P4 and remove a higher level of the hierarchy, then do a sync.

Is this a known issue?

Thanks,
Marco



_______________________________________________
perforce-user mailing list - perforce-***@perforce.com
http://maillist.perforce.com/mailman/listinfo/perforce-user
Grills, Jeff
2005-06-15 17:21:01 UTC
Permalink
The issue isn't with perforce, it's that you deleted the files owned by
perforce from your machine without telling the perforce server. One of
the things that gives perforce its speed is that it keeps a database on
the server that knows what clients have versions of what files. When
you do a sync operation, the server compares what it believes your
client has against what you are syncing, and sends you only the files
that have changed. By removing the file(s), you've invalidated the
server's knowledge of your client's state. p4 won't scan your drive
during the sync process like some other version control systems, which
is nice for projects like ours that have 250,000 files per branch.

To remove the file and let perforce know about it, sync the files to #0.
So, "rm my_file" turns into "p4 sync my_file#0". If you've already
removed the files, you could use the sync, or even a flush, to bring the
server's state back into line with what your client contains.

If you have already removed the files and you need to resync them
without telling the server that you've removed them, you can specify the
-f flag to sync. I personally believe that any regular need to sync -f
is indicative of improper use of perforce.

j

-----Original Message-----
From: perforce-user-***@perforce.com
[mailto:perforce-user-***@perforce.com] On Behalf Of
***@smsc.com
Sent: Wednesday, June 15, 2005 10:52 AM
To: perforce-***@perforce.com
Subject: [p4] unable to re-sync after manually deleting files from
workspace

I've noticed that if files are manually removed from a workspace, that
the perforce re-sync does not restore them from
the repository.

e.g.
rm my_file
p4 sync
my_file is NOT restored from the depot.

To get the file back, I need to go through P4 and remove a higher level
of the hierarchy, then do a sync.

Is this a known issue?

Thanks,
Marco
Stephen Vance
2005-06-15 17:44:10 UTC
Permalink
Perforce keeps track of what has been synced and doesn't check whether it
actually exists when determining what to give you during a sync. This is by
design and is part of Perforce's speed.

You can do a 'p4 sync -f my_file' to get the file back. The -f flag tells
Perforce to resend files regardless of whether they are in the have list.

If you want to remove a file in a way that let's Perforce know, use 'p4
sync my_file#none'.

Steve
Post by M***@smsc.com
I've noticed that if files are manually removed from a workspace, that the
perforce re-sync does not restore them from
the repository.
e.g.
rm my_file
p4 sync
my_file is NOT restored from the depot.
To get the file back, I need to go through P4 and remove a higher level of
the hierarchy, then do a sync.
Is this a known issue?
Thanks,
Marco
_______________________________________________
http://maillist.perforce.com/mailman/listinfo/perforce-user
Stephen Vance
mailto:***@vance.com
http://www.vance.com/
Lars Thegler
2005-06-15 17:46:50 UTC
Permalink
Post by M***@smsc.com
I've noticed that if files are manually removed from a workspace, that the perforce re-sync does not restore them from
the repository.
This is by design - to force a syncronisation even though you have
'lied' to the server by removing the file with 'rm' instead of 'p4
delete', run 'p4 sync -f'.

http://www.perforce.com/perforce/doc.051/manuals/cmdref/sync.html#1040665

/Lars
Ralf Huvendiek
2005-06-15 17:52:55 UTC
Permalink
Post by M***@smsc.com
e.g.
rm my_file
p4 sync
my_file is NOT restored from the depot.
You're working against perforce if you remove a file and don't tell it
to perforce. As a matter of fact perforce thinks that you still have
this file.

You should either to a forced update (p4 sync -f). Or better let
perforce remove the file by doing a p4 sync myfile#none. This way the
server will correctly update it's view of you client.

Ralf
Jay Glanville
2005-06-15 17:52:59 UTC
Permalink
I've noticed this behaviour too. The way that I've interpreted it is
that the server is trying it's best to be efficient.

Basically:
1) sync -- p4 sends revision 5 of file my_file to your workspace
2) rm my_file -- p4 does not know of this delta
3) sync -- p4 thinks, "I've already given him #5, and there is no newer
version, so I won't send it to him again."

In other words, p4 sync doesn't actually look at your hard drive unless
it has to.

If you know that you've deleted a file, you can force a resync using the
p4 sync -f my_file#head
Or
p4 sync -f my_file#have
Additionally, you can ask p4 if there are any files missing (that you've
deleted without p4's knowledge) through the "p4 diff -sd" command. When
this command in used in conjunction with the "p4 diff -de" and the "p4
sync -f" command, you will find it very easy to get your workspace's
consistent with the server.

Hope this helps.

JDG
-----Original Message-----
Sent: Wednesday, June 15, 2005 11:52 AM
Subject: [p4] unable to re-sync after manually deleting files
from workspace
I've noticed that if files are manually removed from a
workspace, that the perforce re-sync does not restore them from
the repository.
e.g.
rm my_file
p4 sync
my_file is NOT restored from the depot.
To get the file back, I need to go through P4 and remove a
higher level of the hierarchy, then do a sync.
Is this a known issue?
Thanks,
Marco
_______________________________________________
http://maillist.perforce.com/mailman/listinfo/perforce-user
Ivey, William
2005-06-15 17:53:32 UTC
Permalink
Post by Braucht, Jason
-----Original Message-----
I've noticed that if files are manually removed from a
workspace, that the perforce re-sync does not restore them from
the repository.
That's correct because you didn't tell Perforce you were
removing them and the list of what you currently have
resides on the server. You can force the re-sync with the
-f flag. (The correct way to remove files from your workspace
is, of course, with something like p4 sync //depot/file#none
or the equivalent menu command.) -Wm

Loading...