I have a java application which takes a branchspec name and use
p4 integrate -b <branchSpec>
command to do the integration.
I am using Runtime.getRuntime().exec() for this purpose.
Everything was working fine till one day I got problem due to an integration. After investigating, I found out that perforce is masking a error "can't branch exclusive files" and that's why I could not get it as an error (the process is returning error code 0).
I don't know how many such errors perforce is masking. To overcome this problem, I decided to check each output line such that it should match the output syntax.
But I couldn't find out what is the output syntax of 'p4 integrate'.
It is not given in Perforce documentation of Integrate command either.
What I could manage to get by some experiments is:
<destination_fileSpec>-[(branch/sync)(integrate)(delete)] from <source_fileSpec>
Is anything missing?
I'd look at the P4Java API, which can run any Perforce command and provides much cleaner error handling.
Related
I am a Perforce beginner (and a coder beginner to be frank). I got this error message when I Checkout → Submit. I would like to try to solve these out of date files, but what and where are they? Any advice would be great, thanks!
Log does not seem to show any list of "out of date files"
Look at changelist 51 in the "Pending" tab. If there are any files with question marks next to them, they require a resolve (that's where you combine the changes in your workspace with newer changes from the depot). You can resolve all outstanding files by just right-clicking changelist 51 and selecting "Resolve..."; it will iterate through all the necessary resolves automatically.
If that doesn't fix it, you should be able to get a better error message by going to the command line and running the p4 submit -c 51 command suggested by the error message. The submit will fail for the same reason, but at the command line you should be able to see the list of files that were included in the changelist, which ones failed to submit, and more information about why. (For example, if a file has been deleted and you were trying to edit it, an edit makes no sense and you need to revert it and/or reopen it as a re-added file -- the error messages at the command line will give you more information about cases like these.)
When I am trying to add files from the command line I get the error saying files not in client view what does it mean ?
createdCLNumber = p4.save_change(changeList)[0].split()[1]
>>> createdCLNumber
'1157539'
>>> p4.run_add("-c", createdCLNumber, "/Users/ciasto/ciasto_piekarz/sandbox/main/upgrade_tools/upgrade_gitlab")
Traceback (most recent call last):
P4.P4Exception: [P4#run] Warnings during command execution( "p4 add -c 1157539 /Users/ciasto/ciasto_piekarz/sandbox/main/upgrade_tools/upgrade_gitlab" )
[Warning]: '/Users/ciasto/ciasto_piekarz/sandbox/main/upgrade_tools/upgrade_gitlab - file(s) not in client view.'
The error means that the file you are trying to add is not in your client view.
According to the error message, the local file is:
/Users/ciasto/ciasto_piekarz/sandbox/main/upgrade_tools/upgrade_gitlab
Is this path under your client's Root, and does the View map it to a depot path? If not, there's no defined depot path for it to be added to.
Unsolicited advice time: I would highly recommend gaining some basic familiarity with Perforce from the command line before trying to automate Perforce workflows with P4Python! It's much easier to make corrections for simple beginner mistakes like this and gain an understanding of the core concepts (e.g. how to define client workspaces and use them to interact with depot files) if you're entering commands at an interactive prompt than if you have to modify a script and start over from scratch for each debugging session. Everything you learn at the command line has a 1:1 mapping to the Python API, so the knowledge will transfer extremely well. The API is designed for people who already have familiarity with Perforce commands and data models, so people who dive into it without knowing Perforce beforehand always end up feeling very lost. I've seen it a hundred times.
(Almost every time I give this advice people ignore it because they "don't have time" to learn how to use the CLI before diving into writing their script, but I can guarantee you're going to end up spending about a month learning how to use Perforce via P4Python when you could have mastered it in a single afternoon of messing around in the terminal.)
I'd like to run a shell script that would tell me if a Groovy file is syntactically correct without executing it. The code wouldn't be run, just validated.
I see that there are similar questions, but I would like a simple command line command. I thought there would be parameter for the compiler, but couldn't find it.
I didn't manage to get a direct answer. My problem was that I was making a Jenkins pipeline script and I'd like to verify it before commit and push. This was I would get simples errors in less time.
I've solved my problem using a VSCode Extension to validate the file before committing. No more typos in committed in my version control.
I searched all over the net, but couldn't seem to find an answer.
What is the best way to find if an opened file needs to be resolved before submitting programmatically (using p4 command line tool).
Note: I need to find it before submitting (I know perforce will throw an error on submission, which doesn't suit my needs).
To see unresolved integrations, use
p4 resolve -n
I'm trying to add this p4sql query as a Custom Tool in P4V (Windows) by adding p4sql.exe as the application and
-s "select * from changes where lcase(description) like '$%$D$%' and p4options='longdesc';"
as Arguments.
When I execute the command and enter '123' as input, the following error comes back:
p4sql error:
Usage: p4sql -h for usage.
Option: 12 is undefined.
What escape mechanism am I missing?
I recently updated the question you referenced and, as I stated, there is a bug in P4V, and P4SQL seems pretty flaky as well. You can get it to work some of the time if you put spaces between the "$%" and the "$D". Change this:
...like '$%$D$%' and...
to this:
...like '$% $D $%' and...
It will work some of the time after making this change, but some searches will still fail as those spaces become part of the search string. I've also noticed some searches fail for reasons I can't explain. I reported this to Perforce last October, and they confirmed it was a bug, but have yet to fix it.
You're better off using one of the solutions mentioned in the other question. Use P4Win or dump the change lists to a file and then search the file.