Jump to content


P4 submit multiple files

submit P4

  • Please log in to reply
11 replies to this topic

#1 fwilli

fwilli

    Newbie

  • Members
  • Pip
  • 6 posts

Posted 08 July 2015 - 02:15 PM

It's possible to submit multiple files using wildcards. But how can you submit miltiple files by their file names? I'm looking for something like:
p4 submit file1.txt, secondfile.csv
(does not work like this)

#2 P4Shimada

P4Shimada

    Advanced Member

  • Members
  • PipPipPip
  • 831 posts

Posted 08 July 2015 - 05:59 PM

Hi Flurin,

Yes, you can add multiple files from the command line a couple of ways. For example:

A] List several filenames with a space in between each file name

$ p4 add afile bfile cfile
//depot/afile#1 - opened for add
//depot/bfile#1 - opened for add
//depot/cfile#1 - opened for add


B] Use the global option -x argfile which instructs Perforce to read arguments, one per line, from the specified file. If file is a single hyphen (-), then standard input is read.

See Global Options: http://www.perforce....al.options.html

$ cat filelist.txt
afile
bfile
cfile


$ p4 -x filelist.txt add
//depot/afile#1 - opened for add
//depot/bfile#1 - opened for add
//depot/cfile#1 - opened for add

REFERENCES

- Adding a Directory Tree
http://answers.perfo...com/articles/KB

- Issuing P4 Commands
http://www.perforce....er.usingp4.html

- Scripting and Reporting
http://www.perforce.....scripting.html

#3 fwilli

fwilli

    Newbie

  • Members
  • Pip
  • 6 posts

Posted 09 July 2015 - 12:23 PM

Thanks Shimada for your reply!
I'm not yet there... :wacko:

When I use
p4 submit -r -d "submit 2" "C:\Perforce\workspace\file.csv" "C:\Perforce\workspace\New Text document.txt"
then I get
Missing/wrong number of arguments.

Using
p4 -x - submit -r -d "submit 2"
I can submit 1 file from standard input but if I try to have two files separated by line feed I also get
Missing/wrong number of arguments.

How can I feed the file names in order that p4 submit can process them in one go?
(I'm programming with LabVIEW on Windows using System Exec.vi to pass the command lines which allows me to pass a string as standard imput)

BR Flurin

#4 rhummer

rhummer

    Advanced Member

  • Members
  • PipPipPip
  • 87 posts
  • LocationMadison, WI

Posted 09 July 2015 - 01:22 PM

I think you might be miss understanding how submitting files in perforce works.  The submit command only submits a pending changelist. You cannot use submit to submit arbitrary files.

You need to move your files to a pending changelist then you can submit those files are part of that changelist.

This document should help you out:

Introducing Perforce: Working with files
http://www.perforce....king_with_files
Lead Tools Engineer
Raven Software

#5 fwilli

fwilli

    Newbie

  • Members
  • Pip
  • 6 posts

Posted 10 July 2015 - 09:04 AM

My files are all in the default change list. Using P4V I can select multiple files to submit - what it does in the background I don't know.
Why is it possible to submit multiple files using wildcards but not by feeding multiple files to standard imput??? :huh:

If I have to create a numbered changelist first then I need to know how to do that whith code line only without getting a form.
I guess I have to use p4 change -i somehow. Can somebody post a sample please?

#6 fwilli

fwilli

    Newbie

  • Members
  • Pip
  • 6 posts

Posted 20 July 2015 - 09:52 AM

There are still open questions regarding submit of multiple files in one go. Can anybody advise on above post? Maybe you, Shimada?

#7 rhummer

rhummer

    Advanced Member

  • Members
  • PipPipPip
  • 87 posts
  • LocationMadison, WI

Posted 20 July 2015 - 01:12 PM

The log window in P4V shows exactly what it does.  IIRC it makes a pending changelist of the files you select and then submits that pending changelist.
Lead Tools Engineer
Raven Software

#8 P4Lester

P4Lester

    Advanced Member

  • Members
  • PipPipPip
  • 144 posts

Posted 20 July 2015 - 01:46 PM

View Postfwilli, on 20 July 2015 - 09:52 AM, said:

There are still open questions regarding submit of multiple files in one go. Can anybody advise on above post? Maybe you, Shimada?

Assuming there is nothing in your pending changelist, here is one way to do it:
p4 add file1.txt secondfile.csv
p4 submit

(If there is other extra files showing in the "Files" field, remove them before saving the spec file and they will be left in your pending changelist)

Cheers!

I work for Perforce.
Workshop | Twitter | LinkedIn | about.me


#9 fwilli

fwilli

    Newbie

  • Members
  • Pip
  • 6 posts

Posted 21 July 2015 - 12:00 PM

OK it seems like I'm not clear about what I want to do (I don’t want to add files):
I'm programming with LabVIEW that means that I check out a complete project with multiple files saved in different folders. Now I want to rename one of the folders. In LabVIEW the project file keeps the references between the different files. That means that I have to rename the folder within LabVIEW to not lose the references. At the same time I want to keep the history in Perforce. I found a way to do that for a file using a LabVIEW program that sends the command lines:
  • Copy the file in Perforce using
    p4 integ "oldfilepath" "newfilepath"

  • check out new file
    p4 edit "newfilepath"

  • have LabVIEW to save the file to the new path

  • submit the old file
    p4 submit -f submitunchanged -d "close old" "oldfilepath"

  • delete old file
    p4 delete "oldfilepath"
    p4 submit -f submitunchanged -d "delete old" "oldfilepath"

  • add the new file
    p4 submit -f submitunchanged -d "add new" "newfilepath"
This works fine: both history in Perforce and references in LabVIEW are maintained.

Now If I want to rename a folder with lots of files. I could just repeat above procedure for each file but then I would get tons of submits for that folder and thus a mess. So I want to do 1 submit for all files that I moved (but not for all in the default change list) (3 times: once for each step 4. 5. 6.). And this has to happen with command lines only - no forms!

Based on rhummer’s replies it seems that it is not possible to submit a list of files (although you could do it if use of wildcards would cover all the files). So I need a numbered change list to do this. The remaining question is thus:
How do I create a numbered changelist with all the specified files in it using code lines only without getting a form?
I guess I have to use p4 change -i somehow. Can somebody post a sample please?

Any help is really appreciated. :)

Is this really so exotic that nobody did it before?

#10 P4Shimada

P4Shimada

    Advanced Member

  • Members
  • PipPipPip
  • 831 posts

Posted 21 July 2015 - 06:46 PM

Hi Flurin,

What version of the Perforce (p4d) server and (p4) client are you using?

#11 fwilli

fwilli

    Newbie

  • Members
  • Pip
  • 6 posts

Posted 22 July 2015 - 08:58 AM

Server version: P4D/NTX86/2014.2/978861 (2014/12/19)
P4V version: Perforce Visual Client/NTX64/2014.2/985932
Rev. P4/NTX64/2014.2/978861 (2014/12/19)

#12 Mailman Sync

Mailman Sync

    Advanced Member

  • Maillist Aggregator
  • 2495 posts

Posted 30 July 2015 - 12:20 PM

Originally posted to the perforce-user mailing list by: Michael Mirman


"p4 submit" can have only one file spec.
In cases when it works for me for multiple files is something like this:

p4 submit -r -d "submit 2" C:\Perforce\workspace\...

Obviously, sometimes the files are mixed more than what I want to put in one change - then I need to create a change (or changes) before I submit different sets of files.

HTH,

--Michael Mirman
508-647-7555
MathWorks, Inc.
3 Apple Hill Dr, Natick, MA 01760

-----Original Message-----
From: perforce-user-bounces@perforce.com [mailto:perforce-user-bounces@perforce.com] On Behalf Of fwilli
Sent: Thursday, July 09, 2015 8:25 AM
To: perforce-user@perforce.com
Subject: Re: [p4] P4 submit multiple files


Posted on behalf of forum user 'fwilli'.

Thanks Shimada for your reply!
I'm not yet there...  :wacko:

When I use
p4 submit -r -d "submit 2"
"C:\Perforce\workspace\file.csv"
"C:\Perforce\workspace\New Text document.txt"
then I get  Missing/wrong number of arguments.  
Using  p4 -x - submit -r -d "submit 2"  I can submit 1 file from
standard input but if I try to have two files separated by line feed I also get
Missing/wrong number of arguments.  
How can I feed the file names in order that p4 submit can process them in one
go?
(I'm programming with LabVIEW using  System Exec.vi  to pass the command
lines which allows me to pass a string as standard imput)

BR Flurin



--
Please click here to see the post in its original format:
  http://forums.perfor...-multiple-files
_______________________________________________
perforce-user mailing list  -  perforce-user@perforce.com
http://maillist.perf...o/perforce-user
_______________________________________________
perforce-user mailing list  -  perforce-user@perforce.com
http://maillist.perf...o/perforce-user






Also tagged with one or more of these keywords: submit, P4

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users