Perforce line-by-line merge - perforce

I am trying to get familiar with P4 trying to resolve a merge conflict. Let's suppose User1 and User2 got their development stream from mainline and they are both working on the same file: User1 write "string 1" first and submit changes and copied to main. User2 get the new file and add a new string "another string". User2 do not submit. User1 change "string 1 " into "string 2" and submit changes again.
User2 try to submit change but cannot copy to main because first line conflicted. So trying to merge-down with 3-way merge tool do not let User2 what to select line-by-line. Is that the normal behavior? The only solution seems to accept User2 solution and manually edit first line to change "1" into "2". I am not sure why it is not possible as User2 still got the old "string 1" which has nothing to do with the new line being added..

Assuming "another string" got added immediately after "string 1", here's what the conflict resolution looks like (at the command line):
>>>> ORIGINAL //depot/merge/same_file.txt#2
string 1
==== THEIRS //depot/merge/same_file.txt#3
string 2
==== YOURS //Samwise-dvcs-1509687817/merge/same_file.txt
string 1
another string
<<<<
User 1's change is "THEIRS", and User 2 (the one who's doing the merge) is "YOURS". Since the changes are right next to each other, they're grouped into a single "chunk" -- "string 1" no longer exists in the "THEIRS" leg, so it's not obvious to the merge algorithm where "string 2" would go relative to "another string".

Related

Trouble with Groovy to print Changelist description

I want to print the Changelist description of each changelist for a Particular stream , but the description that i am getting as output is limited to certain set of characters
changelistList.each { IChangelistSummary cl ->
println cl.getDescription()
}
This is giving a limited CL description instead of the Full description as i see in p4V
printed by script is - "settings IL customization"
But the actual description is "settings IL customization Fix_For_TDP XXXXX_Additional Services section expanded on both Provide and Change"
Can any one help? what is wrong here? I dont get any compile errors, the script executes fine, just that i dont get the full description printed i even tried to use println cl.getDescription().toString() but it doesnt help
You may need to use the getChangelist() method to get the changelist with the full description: https://www.perforce.com/perforce/r17.2/manuals/p4java-javadoc/com/perforce/p4java/server/delegator/IChangeDelegator.html

If either of the files exist then send email alert in bash shell script

Trying to mock a little shell script.. There is a process that already exists which creates one of the two files (i.e, file1 or file2). My goal is to be able to send email alert depending on which file is created.
For example, if file1 exists then send email to John, David, Smith stating that file1 was created. If file2 exists then send an email to the same group of people (John, David, Smith ) stating that file2 was created.
If I write a simple if-else it will work but I will need to repeat some parts of the code which I am trying to avoid.
#!/bin/bash
file="file1"
if [ -f "$file1" ]
then
send email to three people mentioned
else
send email to three people mentioned saying file2 was created since it always creates two files
fi
}
Here I am trying to construct a script in a better way and also I don't want to repeat "send email..." commands three times because I may need to add more people into the list in the future.
Please help. Thanks in advance.
You can create a function block that send a mail to a desired list of people.Call the function from either of the case
Something like
#!/bin/bash
userlist="$HOME/myusers.cfg" # one user per line
function send_alert {
while read -r user comment; do
echo "my command to send to ${user}"
echo "subject=$1"
echo "Content=Hello ${comment}\n$2"
done < "${userlist}"
}
file="file1"
if [ -f "$file1" ]; then
send_alert "My subject" "Content: ${file1} exists."
else
send_alert "My subject" "Content: ${file2} exists."
fi
I added an optional field comment in the myusers.cfg, so you can add some comment after a space (name person, something).
You can adjust send_alert for more business rules, such as only send once an hour an alert, only send during working hours except for the person on night shift, whatever.

what is "ghost string" in testlink? ghost string is optionally generated many items in testlink

In TestLink you will get a ghost string for various items such as test case, test suite etc. ghost string (like [ghost]"TestCase":"TC001-2","Version":"3"[/ghost]) will appear after clicking on the red ghost icon present on say test case name.
What is this ghost string and what's its purpose?
Ghost strings allow you to reuse text descriptions in different places. When you copy a [ghost] string and paste it in some other place you essentially create a reference to the source text (the source text will be shown to the user instead of the tag). If you change the source text, the ghost string will immediately update in all places where you've used it.
For example:
Create a test case TC001-2 with step 1: Test something
Create a test case TC001-3 with step 1: [ghost]"Step":1,"TestCase":"TC001-2"[/ghost]
Now TC001-3 step 1 description is: Test something
Change TC001-2 step 1 to: Test something different
Now step 1 of both TC001-2 and TC001-3 are: Test something different

REXX/SORT split sequential file

I need to split a sequential Mainframe file. Well, to be precise I need to copy the content from this file to another, starting from a specific keyword. Example:
line1
line2
line3
start line4
line5
line6
In this case I need to search for "start" and copy everything starting from line4 to another file using either REXX or SORT. Any suggestions?
EDIT: What I thought about but not happy with in REXX
"EXECIO * DISKR INPUT (STEM INPUT. FINIS)"
LINEINPUT = 1
LINEOUTPUT = 1
FOUND = 0 /*working like a boolean?
DO WHILE LINEINPUT <= INPUT.0
IF INPUT.LINEINPUT = start line4 THEN DO
FOUND = 1
END
IF FOUND = 1 THEN DO
INPUT.LINEINPUT = OUTPUT.LINEOUTPUT
LINEOUTPUT = LINEOUTPUT + 1
END
LINEINPUT = LINEINPUT + 1
END
Something like this maybe, but this means that I need to go through all those files line by line. Maybe there is a better way in JCL? Maybe Syncsort can do something like this?
RECFM is fixed. FBA to be precise. LRECL 170. The trigger can either be a part of this line or the whole line. This is not important, because it is always the same line in every single file and even the first few characters are unique in the whole file. Means that "start" only appears once in the file.
For a fixed-position start of the trigger:
OPTION COPY
INREC IFTHEN=(WHEN=GROUP,
BEGIN=(1,5,CH,EQ,C'start'),
PUSH=(171:ID=1))
OUTFIL OMIT=(171,1,CH,EQ,C' '),
BUILD=(1,170)
For a variable-position, unique, trigger:
OPTION COPY
INREC IFTHEN=(WHEN=GROUP,
BEGIN=(1,170,SS,EQ,C'start'),
PUSH=(171:ID=1))
OUTFIL OMIT=(171,1,CH,EQ,C' '),
BUILD=(1,170)
WHEN=GROUP gives you PUSH, which will put data from the current record, or a group-number (ID) or number within group (SEQ), to that position on all the records in the group (including the current record). In this case, the "group" is the rest of the file.
The SS is field-type allowing a Sub-String search.
Then an OMIT= (similar to OMIT COND= but after the file has been processed by the control cards) on OUTFIL does the actual selection from the flag (the automatically extended records not with a value from the PUSH will be set to blank) and BUILD to drop off the extra byte.
The extra byte is needed because SORT has no "program storage" for definitions - extra fields have to be on the records (or, for the duration of the current record only, in PARSEd fields).
Sorry for not commenting as i dont have enough reputation i am writing this in answer. Will remove this later
You can achieve this by both the methods i.e. Through REXX or JCL.
Please show us what you tried till now so we can figure out what to improve.

Cannot delete user in SAMBA

I'm using GADMIN-SAMBA program on Linux for administering Samba server, and in the list of users in the "Users" tab in the first row there is the following data:
"WARNING" "Group name not found" "No value has been set" "No value has been set"`
When I select this row and click "Delete" button, the following message appears:
Could not remove the samba user: WARNING
And the row remains unchanged.
I could not find any records with a user named "Warning" in /etc/smb.conf, /etc/samba/smbusers files and in /var/samba/profiles directory. How can this record be removed from the users list?
If I'm not mistaken, the problem is (1) you have no users added to the SAM database, or (2) that you do not have the following SAM files available for pdbedit to read:
/etc/samba/private
passdb.tdb
secrets.tdb
Since samba makes use of pdbedit -L to generate a user list to be displayed. If you either (1) have no users, or (2) do not have the SAM files available, you will generate an error attempting to access that information. It appears that GADMIN is taking the first line returned (the error) as the user and attempting to display it. You cannot delete this.

Resources