I have a load of commits, on a bitbucket branch where I was experimenting on the code. I want to squash all those into just one commit, without squashing all the other commits.
Does this call for a rebase.
Bit confused on what a rebase is.
yep you will get a console to edit the commits: like this:
git rebase -i qa then press keyboard 'i' to edit
you will see like this:
pick etc1
pick etc2
pick etc2
replace the word pick with 'f' and press esc y :wq
pick etc1 //this commit will the one commit
**f** etc2
**f** etc2
and press this command
git push origin +head
Related
On the Jenkins server, Perforce plugin (P4) is installed.
Within my Jenkins server job pipeline (implemented as shared library in groovy-lang), there is a pipeline stage to sync from perforce to the jenkins workspace as:
p4.run("sync")
I want to determine the changelist number of this operation. I need to use this changelist number in the later stages of the pipeline.
I am thinking to do as follows:
p4.run("sync")
changelist_number = p4.run("changes -m1 #have")
Will this work? Or give me a better solution. Also I am very unfamiliar about this topic. It would be nice if you can explain what all this means.
The changelist number (that is, the highest changelist number associated with any synced revision) is returned as part of the p4 sync output if you're running in tagged mode:
C:\Perforce\test\merge>p4 changes ...
Change 226 on 2020/11/12 by Samwise#Samwise-dvcs-1509687817 'foo'
Change 202 on 2020/10/28 by Samwise#Samwise-dvcs-1509687817 'Populate //stream/test.'
C:\Perforce\test\merge>p4 -Ztag sync ...
... depotFile //stream/test/merge/foo.txt
... clientFile c:\Perforce\test\merge\foo.txt
... rev 2
... action updated
... fileSize 20
... totalFileSize 20
... totalFileCount 1
... change 226
Tagged output is converted into a dictionary that's returned by the run method, so you should be able to just do:
changelist_number = p4.run("sync")[0]["change"]
to sync and get the changelist number as a single operation.
There are some edge cases here -- deleted files aren't synced and so the deleted revisions won't factor into that changelist number.
A more ironclad method is to put the horse before the cart -- get the current changelist number (from the depot, not limited to what's in your client), and then sync to that exact number. That way consistency is guaranteed; if a new changelist is submitted between the two commands, your stored changelist number still matches what you synced to.
changelist_number = p4.run("changes", "-m1", "-ssubmitted")[0]["change"]
p4.run("sync", "#{changelist_number}")
Any other client syncing to that changelist number is guaranteed to get the same set of revisions (subject to its View).
In TFVC you can merge changesets from Branch A into Branch B. Is it possible to view which changesets - specifically which ids - from Branch A were merged into Branch B?
You can use the following script :
$tfsUrl = "http://{Server}:{Port}/{Organization}/{Collection}"
$destinationBranchPath = "$/..."
$sourceBranchPath = "$/..."
# Change top with count of changesets you want to check
$body = 'repositoryId=&searchCriteria={"itemPath":"'+ $destinationBranchPath+'","itemVersion":"T","top":50}'
#Get top X changesets under destinationBranchPath
$changeSets = (Invoke-RestMethod -Method post "$tfsUrl/{Project}/_api/_versioncontrol/history?__v=5" -Body $body -UseDefaultCredentials).results
#Run over all changesets and check if sourceBranchPath is part of merage soruce path
foreach($changeSet in $changeSets)
{
$IsMerged = (Invoke-RestMethod -Method Get "$tfsUrl/_apis/tfvc/changesets/$($changeSet.changeList.changesetId)/changes" -UseDefaultCredentials).value.mergeSources.serverItem -like "*$sourceBranchPath*"
if($IsMerged)
{
#Print results
Write-Output $changeSet.changeList
}
}
Using the tf.exe command line tool, the merges command can provide the merge history between two branches.
So, in my example, from the source control root folder on my local machine I can run the following command in the shell of my choice tf vc merges a b /recursive to get a list of which changesets from a were included in merges to b:
Changeset Merged in Changeset Author Date
--------- ------------------- -------------------------------- ----------
20096 20292 Joey Bloggs 30/04/2018
20102 20292 Joey Bloggs 30/04/2018
20103 20292 Joey Bloggs 30/04/2018
Where the first column contains the changeset from branch a and the second column the changeset that merged it into branch b.
In order to get this working I had to add the folder location of tf.exe to my PATH variable.
Just adding another solution for anyone that don't want to use commands, but it will be a bit more time consuming if you want to know more than one merge
On TFS history of the merged branch, you can right click a changeset and choose Track Changeset option and then select the origin branch + merged branch in the next screen
https://learn.microsoft.com/en-us/azure/devops/repos/tfvc/view-where-when-changesets-have-been-merged?view=azure-devops
I'm running two different Neo4j servers and running the same queries on them in the same order.
I want to check if both databases are equivalent, for that purpose I'm generating a dump of the entire database (and I do realize this is not a real alternative for huge databases) with bin/neo4j-shell -c "dump" > /home/my_user/dump.txt and them comparing the md5 hashes generated with md5sum dump.txt.
The generated dump.txt files look pretty much identical except that the variables which identify the nodes are sometimes different, which of course generates completely different hashes for each file. Example:
dump.txt #1
begin
commit
begin
create (_6:`Person` {`name`:"Arthur", `title`:"King"})
create (_7:`Person` {`name`:"Saladin", `title`:"Sultan"})
create (_8:`Army` {`name`:"Saxon army"})
create (_6)-[:`FIGHTS_AGAINST`]->(_8)
create (_7)-[:`LEADS`]->(_8)
;
commit
dump.txt #2
begin
commit
begin
create (_7:`Person` {`name`:"Arthur", `title`:"King"})
create (_8:`Person` {`name`:"Saladin", `title`:"Sultan"})
create (_9:`Army` {`name`:"Saxon army"})
create (_7)-[:`FIGHTS_AGAINST`]->(_9)
create (_8)-[:`LEADS`]->(_9)
;
commit
I'm guessing right now it works based on the number of nodes the database has had so far and when I clean it with MATCH (n) DETACH DELETE n it doesn't reset this counter. The only way I found to reset it is by restarting the server, which isn't exactly practical.
I guess the simplest way to solve my issue would be to make a script that erases all numbers preceded by an _, but wouldn't it, in very specific situations, generate false positives? Like if the queries where very similar and in the same order but updated different nodes.
Does anyone have a better alternative? Maybe a command to reset this node counter?
Ended up using regular expressions on Bash to achieve the desired result of removing all node identifiers from the files.
cat dump.txt | sed s/\(_[0-9]*/\(/g > dump_new.txt
Which from a dump.txt like this one:
begin
commit
begin
create (_18:`Person` {`name`:"Arthur", `title`:"King"})
create (_19:`Person` {`name`:"Saladin", `title`:"Sultan"})
create (_20:`Army` {`name`:"Saxon army"})
create (_18)-[:`FIGHTS_AGAINST`]->(_20)
create (_19)-[:`LEADS`]->(_20)
;
commit
Generates a dump_new.txt like this one:
begin
commit
begin
create (:`Person` {`name`:"Arthur", `title`:"King"})
create (:`Person` {`name`:"Saladin", `title`:"Sultan"})
create (:`Army` {`name`:"Saxon army"})
create ()-[:`FIGHTS_AGAINST`]->()
create ()-[:`LEADS`]->()
;
commit
I have a list of JIRA issues that have one or many commits:
J1 (c11, c12, ..., c1n)
J2 (c21, c22, ..., c2m)
...
Jk (ck1, ck2, ..., cky)
where n,m,y >= 1
Using Crucible I'm trying to create reviews for J1,..., Jk (or for c11, ..., cky - because it's ok if the number of Crucible reviews is bigger than the number of JIRA issues).
In order to achieve this, I want to see using EyeQL which are the commits without a created review (not necessarily closed).
If I run the following query:
select ...
from ...
where
...
and not reviewed
group by ...
return ...
it returns only the commits that don't have a "complete" review. But I want to see only the commits that don't have a "review" (regardless of its state).
How can I achieve this behavior?
I want something like and doesn't have any created review instead of and not reviewed.
Using the clause not in any review should work, i.e.:
select revisions from dir "/" where (not in any review) order by date desc group by changeset return path, revision, author, date, csid
See the EyeQL reference for the full grammar description with examples.
Is there a way to search TFS using PowerShell to find all changesets that contain some sub-string in the check-in comment? I'd like to see the individual files in all the changesets in one view. In my case I am searching for all changesets that contain a defect number e.g. 'D-12345'.
I tried the example as outlined here. But running ...
tf history $/MyCodeRepo/Trunk -r /noprompt /format:detailed | ? { $_.comment -like *D-12345* }
... gives me several errors:
You must provide a value expression on the right-hand side of the
'-like' operator.
You must provide a value expression on the
right-hand side of the '*' operator.
Unexpected token 'D-12345*' in
expression or statement.
I then tried putting quotes around the search string but that just returned no results.
I have TFS power tools installed and I know you can use searchcs to search by Comment but you have to open each changeset individually.
Any ideas how I can do this?
Thanks,
Try with
tf history $/ -r | ? { $_.comment -like *D-12345* }
You can also try with fpt searchcs