Max.Ritter | 1 Mar 2004 16:15

[p4] How to "sync" a client workspace 100%?

Hello,

I have a client workspace with about 200 directories and about 7000 files.
After working in it for a while there are a number of empty directories
(rmdir option was not set when deleting files), a lot of temporary and
generated files, etc.

How can I get the workspace into a state that matches the depot 100%,
i.e., clean up everything that is not in the depot? Before cleaning it
would of course be nice to see a list of things that will be deleted.

Is there a way to do this elegantly with Perforce commands?

Thanks in advance,
Max.

_______________________________________________
perforce-user mailing list  -  perforce-user <at> perforce.com
http://maillist.perforce.com/mailman/listinfo/perforce-user

Karl Philipp | 1 Mar 2004 16:28
Picon

[p4] How to identify the workspace location of an added file

Hi,

what is (are) the appropriate p4 command(s) to identify the workspace
location of a file that I've added (NOT opened for edit) to a pending
changelist?

Regards,

  Karl
--

-- 
Karl Philipp

Phone : +49 6151 868 - 518
Fax   : +49 6151 868 - 980
eMail : mailto:karl.philipp <at> danet.de

Danet GmbH
Business Integration
Gutenbergstr. 10
64331 Weiterstadt, Germany
WWW : http://www.danet.de

_______________________________________________
perforce-user mailing list  -  perforce-user <at> perforce.com
http://maillist.perforce.com/mailman/listinfo/perforce-user

Arnt Gulbrandsen | 1 Mar 2004 16:56
Picon
Favicon
Gravatar

Re: [p4] How to "sync" a client workspace 100%?

Max.Ritter <at> brainlab.com writes:
> How can I get the workspace into a state that matches the depot 100%, 
> i.e., clean up everything that is not in the depot? Before cleaning 
> it would of course be nice to see a list of things that will be 
> deleted.
>
> Is there a way to do this elegantly with Perforce commands?

There is the brutal way:

p4 sync ...#none
rm -rf *
p4 sync ...

I don't like that. (In fact, I may even have got the syntax wrong.) So I 
usually do things like this, which will find all files not managed by 
perforce:

p4 have ... | sed 's/.* - //' > /tmp/a
find `/bin/pwd` -type f -print > /tmp/b
cat /tmp/a /tmp/b /tmp/b | sort | uniq -u

Arnt
_______________________________________________
perforce-user mailing list  -  perforce-user <at> perforce.com
http://maillist.perforce.com/mailman/listinfo/perforce-user

Arnt Gulbrandsen | 1 Mar 2004 17:12
Picon
Favicon
Gravatar

Re: [p4] How to "sync" a client workspace 100%?

Arnt Gulbrandsen schrieb:
> p4 have ... | sed 's/.* - //' > /tmp/a
> find `/bin/pwd` -type f -print > /tmp/b
> cat /tmp/a /tmp/b /tmp/b | sort | uniq -u

Replace one b by a on that line. Sorry.

The code actually does something like this:

1. Make a list of all files perforce knows
2. Make a list of all files.
3. Make a third list containing list 1 twice and list 1 once.
4. See what's present exactly once in that final list. (Anything that 
was in list 1 will be present twice.)

Arnt
_______________________________________________
perforce-user mailing list  -  perforce-user <at> perforce.com
http://maillist.perforce.com/mailman/listinfo/perforce-user

Chuck Karish | 1 Mar 2004 17:43
Picon

Re: [p4] How to identify the workspace location of an added file

Karl Philipp wrote:

> what is (are) the appropriate p4 command(s) to identify the workspace
> location of a file that I've added (NOT opened for edit) to a pending
> changelist?

'p4 where <dirname>/...' where <dirname> is the directory that contains 
the  new file.
_______________________________________________
perforce-user mailing list  -  perforce-user <at> perforce.com
http://maillist.perforce.com/mailman/listinfo/perforce-user

jab | 1 Mar 2004 18:03
Picon
Favicon

Re: [p4] How to identify the workspace location of an added file


On Mar 1, 2004, at 7:28 AM, Karl Philipp wrote:

> Hi,
>
> what is (are) the appropriate p4 command(s) to identify the workspace
> location of a file that I've added (NOT opened for edit) to a pending
> changelist?
>
	The fastest single command is:
		p4 -Ztag  opened

	Notice that the 'tagged' output - people writing Python ("p4 -G 
opened")
	or Ruby ("p4 -R opened") might recognize this - has multiple pieces
	of information for each file.

	I have one file opened in my workspace at the moment. Here's the result
	of "p4 -Ztag opened":

... depotFile //depot/main/development/working/events.rb
... clientFile //jab.development/working/events.rb
... rev 8
... action edit
... change default
... type ktext
... user jab
... client jab.development

	The "depotFile" entry is what you'll see printed in a normal "p4 
(Continue reading)

Gary Sanders | 1 Mar 2004 19:20

RE: [p4] How to identify the workspace location of an added file

Jeff,

That is INCREDIBLY useful! You rock!

Thanks,
Gary

> -----Original Message-----
> From: jab [mailto:jab <at> pobox.com] 
> Sent: Monday, March 01, 2004 9:04 AM
> To: Karl Philipp
> Cc: Mailinglist Perforce User (Perforce Software)
> Subject: Re: [p4] How to identify the workspace location of 
> an added file
> 
> 
> 
> On Mar 1, 2004, at 7:28 AM, Karl Philipp wrote:
> 
> > Hi,
> >
> > what is (are) the appropriate p4 command(s) to identify the 
> workspace 
> > location of a file that I've added (NOT opened for edit) to 
> a pending 
> > changelist?
> >
> 	The fastest single command is:
> 		p4 -Ztag  opened
> 
(Continue reading)

Gary Sanders | 2 Mar 2004 00:22

RE: [p4] How to "sync" a client workspace 100%?


Those commands are really handy, Arnt.  Thanks!

I have a similar need to regularly reconcile the repository against files on
the systems (on Windoze), but the large number of compiled, etc. output
files make it ugly to find what I'm after.  Here's a Perl script I wrote a
long while ago.  It can ignore file names, file extensions and file
suffixes.  

Your mileage may vary!  General "use at your own risk" disclaimers apply.  I
hope this benefits someone besides myself.   Comments and suggestions for
improvements are always welcome!

Cheers,
Gary

-------------------------------------------------------
use File::Find;
use Cwd;
use strict;

my( <at> localFiles,$PND,$cwd, <at> p4Files,%p4Files,$f);
our( <at> ignoreExtensions, <at> ignoreFiles, <at> ignoreSuffixes, <at> localFiles);

 <at> ignoreExtensions = qw(obj o idb pdb pch tmp map a dll exp ilk lib
				res plg sbr bin raw out hex);
 <at> ignoreFiles      = qw(makefile depend.mak);
 <at> ignoreSuffixes   = qw(_res.h wpj.orig);

$PND = '#'; # make emacs perl mode happy
(Continue reading)

Chuck Karish | 2 Mar 2004 07:24
Picon

Re: [p4] How to "sync" a client workspace 100%?

Arnt Gulbrandsen wrote:

> Arnt Gulbrandsen schrieb:
>
>> p4 have ... | sed 's/.* - //' > /tmp/a
>> find `/bin/pwd` -type f -print > /tmp/b
>> cat /tmp/a /tmp/b /tmp/b | sort | uniq -u
>
>
> Replace one b by a on that line. Sorry.
>
> The code actually does something like this:
>
> 1. Make a list of all files perforce knows
> 2. Make a list of all files.
> 3. Make a third list containing list 1 twice and list 1 once.
> 4. See what's present exactly once in that final list. (Anything that 
> was in list 1 will be present twice.)
>
Or you could do this:

 find * -type f | p4 -x - files 2>&1 > /dev/null | awk '{print $1}'
_______________________________________________
perforce-user mailing list  -  perforce-user <at> perforce.com
http://maillist.perforce.com/mailman/listinfo/perforce-user

Max.Ritter | 2 Mar 2004 09:47

RE: [p4] How to "sync" a client workspace 100%?

Thanks for the useful tips! The following two lines give me what
I was looking for:

find * -type f | p4 -x - files 2>&1 > /dev/null | awk '{print $1}'
find * -type d | p4 -x - dirs 2>&1 > /dev/null | awk '{print $1}'

Now I can use the output to clean up files and directories that
are not in the depot :-)

Cheers,
Max.

> Chuck Karish wrote:
> 
> > Arnt Gulbrandsen schrieb:
> >
> >> p4 have ... | sed 's/.* - //' > /tmp/a
> >> find `/bin/pwd` -type f -print > /tmp/b
> >> cat /tmp/a /tmp/b /tmp/b | sort | uniq -u
> >
> >
> > Replace one b by a on that line. Sorry.
> >
> > The code actually does something like this:
> >
> > 1. Make a list of all files perforce knows
> > 2. Make a list of all files.
> > 3. Make a third list containing list 1 twice and list 1 once.
> > 4. See what's present exactly once in that final list. (Anything that 
> > was in list 1 will be present twice.)
(Continue reading)


Gmane