NewDTinStackoverflow
NewDTinStackoverflow

Reputation: 543

Perforce adding a folder to depot

I am new to Perforce. Could you add a new folder under the branch in the depot? I also tried to add one in my workplace but how could I get it to the depot? Do I have to do a merge/integrate or something?

Thanks.

Upvotes: 20

Views: 83052

Answers (7)

user8432627
user8432627

Reputation:

Use command

p4 add directory_to_be_added/...

This will recursively add all contents starting drom "directory_to_be_added"

Upvotes: 18

Feng Zhang
Feng Zhang

Reputation: 1948

I had a situation that I need to add entire folder with files having wildcard name, so had to do it through command line using -f (force), I used "dir /b /s /a-d | p4 -x - add -f"

Upvotes: 1

Gene Bo
Gene Bo

Reputation: 12073

p4 add doesn't support recursive add .

Here's a unix shell work-around to run from within the root folder you want to add:

find . -type f -print | p4 -x - add

Upvotes: 29

Vrushank Doshi
Vrushank Doshi

Reputation: 2608

To add files from a directory in perforce

p4 reconcile -f -c [changeList] -a <dir_path_to add>

Upvotes: 3

Ascendant
Ascendant

Reputation: 2579

If you are using p4v to add a folder recursively, you need to click on:

"Connection" -> "Edit Current Workspace"

then manually add the mapping of the new folder to your depot.

Then go to your "Workspace" view and right click on the root folder, click "Mark for Add" and comment. All the files under it should show up in the new pending change list.

Upvotes: 0

Dave
Dave

Reputation: 6179

From your local workspace, create your folder and a file you want to go inside it. Then either mark it as add from the visual client, or go into the folder from the command line, and type...

p4 add ./new_folder/new_file_name.ext

When you submit, the new file and folder will be in your repository. This assumes that new_folder is a subfolder of your existing workspace. Please let me know if it isn't and I'll update my answer.

Above command will add files under default changelist. And later if you want to see the if files are really added in default changelist

p4 opened

And for the submission of opened files, under the default changelist, to depot

p4 submit 

Upvotes: 16

Mike O&#39;Connor
Mike O&#39;Connor

Reputation: 3813

If your server version is 2012.1 or later, you can use the reconcile command to do this, with full wildcard support:

p4 reconcile //depot/path/to/folder/...

Upvotes: 17

Related Questions