[p4] integrating when destination has been deleted
Weintraub, David
david.weintraub at bofasecurities.com
Fri Sep 1 07:23:06 PDT 2006
> How would you (easily) recursively add a directory
> tree if you have to issue a different command for
> files and directories?
In Subversion, adding a directory automatically adds all the files in
that entire directory tree. Although, there is a "svn mkdir" command,
that's only used if the directory you're creating doesn't already exist
in your work folder. If you're adding a directory tree, you use the
"add" command (which is the same command for adding a file). Subversion
is smart enough to see it's a directory, and realize you want to add
that element to the repository as a directory. It is also smart enough
to realize that you probably also want to add all the files under that
directory too.
$ svn add mydir #One step process for adding directory tree
In ClearCase, you create versioned "elements" via the "mkelem" command.
If the element is a directory, you have to specify either "cleartool
mkelem -eltype dir" or use the alias "cleartool mkdir". Clearcase was
not smart enough to realize that if you are adding an element, and that
element is a directory, you probably want to add that element as a
directory. Also, ClearCase wasn't smart enough to realize that if you're
adding a directory, you probably also want to add the whole directory
tree to the archive. Thus, in order to add a directory tree, it took
several steps:
* Step #1: Find all directories and add them via "cleartool mkdir"
command. Make sure the directories remained checked out since you'll be
adding files to them. You must add directories one at a time, so you
can't use "xargs". The "-nc" stands for "no comment". Otherwise, you'd
be asked for a separate comment for each and every file you're adding:
$ find . -type d -exec cleartool mkdir -nc {} \;
* Step $2: Now find all the files, and add those via the "mkelem"
command. Again, "mkelem" can only do one file at a time, so you can't
use "xargs"
$ find . -type f -exec cleartool mkelem -nc {} \;
* Step #3: Check everything in. In this case, xargs will work:
$ cleartool lsco -recursive . | xargs cleartool ci -c "Adding files"
-----Original Message-----
From: perforce-user-bounces at perforce.com
[mailto:perforce-user-bounces at perforce.com] On Behalf Of Ivey, William
Sent: Thursday, August 31, 2006 12:25 PM
To: perforce-user at perforce.com
Subject: Re: [p4] integrating when destination has been deleted
> -----Original Message-----
> From: perforce-user-bounces at perforce.com
> [mailto:perforce-user-bounces at perforce.com]On Behalf Of Weintraub,
> David
> And that's a problem. I have to keep track of these changes because
> Perforce doesn't version directories. To me, it's the biggest argument
> for making directories full time members of the source archive. Of
> course, such a move can cause trouble. It means we have to handle
> "evil twins", have a mechanism to remind people to make directories
> via the
> "p4 mkdir" command and not directly with "mkdir".
How would you (easily) recursively add a directory tree if you have to
issue a different command for files and directories?
Overloading the add command would seem to make more sense.
-Wm
_______________________________________________
perforce-user mailing list - perforce-user at perforce.com
http://maillist.perforce.com/mailman/listinfo/perforce-user
More information about the perforce-user
mailing list