How to fix P4 "Submitting to multiple branches from one changelist is not allowed" - perforce

my p4 server declined my submission and output error message. "Submitting to multiple branches from one changelist is not allowed"
Here is my example remote-client mapping of the to-be-submitted files.
//depot/projA/Dev/Modules/a/src/moda/file1.cpp //Client/projA/src/moda/file1.cpp
//depot/projA/Dev/Modules/a/src/moda/file2.cpp //Client/projA/src/moda/file2.cpp
//depot/projA/Dev/Modules/a/src/moda/file3.cpp //Client/projA/src/moda/file3.cpp
//depot/projA/Dev/Modules/b/src/modb/file4.cpp //Client/projA/src/modb/file4.cpp
//depot/projA/Dev/Modules/c/src/modc/file5.cpp ///Client/projA/src/modc/file5.cpp
How can I submit the changes into single changelist ?

Related

How to get all merged commits in git that includes a specific sentence?

I want to write a function that get all merged commits on my master, and check for merged commits with a specific sentence.
I have written this function, and it gets only the last commit that includes this sentence, it is as shown here:
def get_commit_message():
commit_message = subprocess.check_output(["git", "log", "-1", "--pretty=format:\'%B\'", "--grep","THE REQUIRED CHANGES"], stderr=subprocess.STDOUT).decode("utf-8").split('\n')
return commit_message
How can i find each and every merged commit message in master that has "THE REQUIRED CHANGES" in it, and not only the last one that has it.
git log -1 ... will limit the output of git log to one single commit.
Drop the -1.

P4python needs to check what files are changed in a specific changelist

Using python and p4python I'm trying to shows the files that are changed in a changelist. I
result = p4.run_describe("2631893", tagged = 0)
This shows the files in a change list and not what is
result = p4.run_diff("-sa")
shows all the changed files in the client. What I am looking for is a run_diff similar functions that gives the name of changed files in a specific changelist. Is it possible?
UPDATE:
After thinking twice, I came to the fact that I shiuld probably write what I am trying to do
The idea is this that I check out some simulink models , run code generation for all models. There are already some generated code in the depot that belongs to each Simulink model. I need to check if the models generate the same code that is already in depo. If they are not the same then the name of those files should be printed. So my strategy is this
1) Make a changelist. DONE
2) check iut the models in that changelist DONE
3) check out all the already gererated files in a different change list (lets call it CL 2) DONE
4) generate code DONE
5) Revert unchanged files from that changelist (dont know how to do. It should only revert unchanged files from THAT Changelist e g. CL2)
6) if CL2 is empty then fine. Otherwise print the file name.
P4.revert('-a' , CL2)
Does not work. And i dont inow how to get the number of file in a CL from python.

Perforce - how to back-out changelist from master branch

I have following changelists in perforce:
1 - some work on //depot/A/file
2 - some work on //depot/A/file
3 - branching of //depot/A to //depot/B
4 .... - some work on //depot/A/file
And I want to backout changelist 2 on //depot/B.
I've tried following:
p4 sync //depot/B/file#1
p4 edit //depot/B/file
p4 sync //depot/B/file#2
....
but error occured on first line.
//depot/B/file#1 - no file(s) at that changelist number.
Is there any way how to achieve this without submitting into //depot/A branch?
Here's what I'd do:
p4 copy //depot/A/...#1 //depot/B/...
p4 submit
p4 merge //depot/A/...#2 //depot/B/...
p4 resolve -ay
p4 submit
p4 merge //depot/A/... //depot/B/...
p4 resolve -am
p4 resolve
p4 submit
You could potentially do this all within a single changelist as well, but it gets a little trickier then -- the above keeps it simple and leaves a history that is easy to follow (i.e. each revision is clearly "copied from this change," "ignored this change", or "merged these changes" rather than a single revision that mushes those actions all together).
You can't simply take out 2 from B because it came together from A as one change (1 & 2).
I think the only way to achieve this is:
roll back 3 on B (p4 edit //depot/B/file; p4 sync //depot/B/file#0; p4 submit //depot/B/file or p4 delete //depot/B/file; p4 submit //depot/B/file)
integrate 1 from A to B
integrate 4 from A to B
Having said that, this has two drawbacks:
if you ever want to re-integrate 2 from A to B in the future, P4 will be confused because it knows that it already has integrated 2 from A to B
if you want to integrate back from B to A, this will propagate the reversal of 2 on B back to A, which probably isn't what you want.
So, even though it's more elaborate, the only correct way to revert an integration is exactly what you don't want to do:
roll back 2 on A
integrate A to B
re-submit 2 on A
Based on your attempt to sync to //depot/B/file#1, I'm assuming the file did not previously exist on //depot/B/...?
If my assumption is correct, you'll want to delete the file:
p4 delete //depot/B/file
and submit it.
If my assumption is incorrect and your newly-branched file is #2 or higher, then:
p4 edit //depot/B/file#1
p4 resolve -ay //depot/B/file
p4 submit

How can I extract the email of a commiter using git?

If I have a specific string how can I use e.g git log to find the email of the committer from the command line?
I don't want to see the commit. I only want the "one-liner" command to give me only the email of the author.
NOTE: I do NOT have a commit id. I only have a search string. I mean a string that I know is part of a commit for sure.
Update after comment from #axiac:
I have a string X that is "unique" in the sense that is introduced by only 1 committer. The committer adds it to file foo.java.
I want having only the string X and foo.java to find the email of the commiter who added the string
git --no-pager log -s --format="%ae"
Source.
How about git log --grep="YOUR_SEARCH_REGEX" --pretty=format"%ce"

how to sync the perforce client to a particular change list using p4 sync command

let us assume depot contains change lists :
change lists :
300
299
280
270
260
I would like to sync my client at change list 280.
if i do p4 sync : my client will be updated with cl : 300 (latest one) which i'm not looking for.
How can we achieve this ?
Perforce uses "#" to indicate change number, so
p4 sync #280

Resources