Lets say i have 2 branches A (main), B(child)
I merge B to A and as a result create changeset 200 in A
Then I move B branch to Retired folder resulting changeset 201
After that I create a new branch C from A resulting changeset 202
Roll back changeset 200 in main branch A resulting changeset 203
Now if i merge Branch C to A as a Reverse Intergration I want to get all the back all the rollback changes in Branch A
But i get the message Nothing to Merge
note i used only Visual studio not command prompt. Any solution woukd be appreciated
When you try to merge from Branch C to A, there is actually no candidate in Branch C (changesets in the source Branch C that have not yet been merged into the destination Branch A), so you get message Nothing to Merge.
You can try to do some modification in Branch C to get a new changeset in Branch C, then perform a merge to Branch A, or you can use Merge command with /force option to force this merge. /force option will ignore the merge history and merge the specified changes from the source into the destination.
Related
I am trying this statement.
CREATE (n:TestEntity), (m1:RelatedEntity)
WITH n,m1
MERGE (m2:RelatedEntity {b:"c"})
WITH n,m1,m2
MERGE (n)-[:REL]->(m1), (n)-[:REL]->(m2)
SET n+={a:1}, m1+={b:"d"}, m2+={d:2}
return n, m1,m2;
This gives an error:
If I change the last MERGE with CREATE, this exact statement works.
If I remove the second relationship and only MERGE the first one, it works. What's going on? Is this a bug?
At this time in Neo4j 4.2.x, MERGE does not support comma-separated patterns, though there is a feature request in the backlog to add that capability.
MERGE does not support comma separation. A workaround is to add the MERGE keyword in front of every node/relation etc.
The below query works:
CREATE (n:TestEntity), (m1:RelatedEntity)
WITH n,m1
MERGE (m2:RelatedEntity {b:"c"})
WITH n,m1,m2
MERGE (n)-[:REL]->(m1) MERGE (n)-[:REL]->(m2)
SET n+={a:1}, m1+={b:"d"}, m2+={d:2}
return n, m1,m2;
I have branch X. Off it branches branch Y and off Y branches Z.
Now I merge from Z to X and TFS complains that it is a baseless merge.
Why?
EDIT 1
To be more concrete, here are the branches:
X - $/xyz
Y - $/rtqa/1/xyz
Z - $/preprod/1/xyz
So, $/rtqa/1/xyz branches off $/xyz and at some point $/preprod/1/xyz branches off $/rtqa/1/xyz:
$/xyz
|
+-----$/rtqa/1/xyz
|
+-----$/preprod/1/xyz
The merge is from $/preprod/1/xyz to $/xyz of a single changeset.
TFS insists it is a baseless merge. Why?
Because TFS VC maintains relationship only between parent and child, not with grand-parent and child.
Here is the similar forum for reference.
I have a query that creates a node, and relates a large number of nodes to it.
Example:
CREATE (target :x {index:'a'})
WITH target
MERGE (x1:x {index:'1'}) MERGE (x1)-[:r]->(target)
MERGE (x2:x {index:'2'}) MERGE (x2)-[:r]->(target)
MERGE (x3:x {index:'3'}) MERGE (x3)-[:r]->(target)
...
MERGE (x1000:x {index:'1000'}) MERGE (x1000)-[:r]->(target)
I have already set an indexes with CREATE CONSTRAINT ON (x:x) ASSERT x.index IS UNIQUE. However, this query is currently taking ~45 minutes to complete.
Is there anything I can do to speed it up? Is adding more CPU power the only option from here?
When you stack MERGE or MATCH statements like that, you can end up with performance issues (related to result rows). For a case like this, use an iterative loop:
CREATE (target :x {index:'a'})
WITH target
FOREACH(i IN RANGE(1, 1000)|
MERGE (a:x {index: toString(i)})
MERGE (a) - [:r] -> (target) )
I am preplexed on why I am getting an issue with this Cypher statment when I have a unique constraint on the address of the location node but am using a merge which should find that if it exists and only return the id for the rest of the statment. What am I missing?
Here is my statement:
MERGE(l:Location{location_name:"Starbucks", address:"36350 Van Dyke Ave", city: "Sterling Heights",state: "MI", zip_code:"48312",type:"location",room_number:"",long:-83.028889,lat:42.561152})
CREATE(m:Meetup{meet_date:1455984000,access:"Private",status:"Active",type:"project",did_happen:"",topic:"New features for StudyUup",agenda:"This is a brainstorming session to come with with new ideas for the companion website, StudyUup. Using MatchUup as the base, what should be added, removed, or modified? Bring your thinking caps and ideas!"})
WITH m,l
MATCH (g:Project{title_slug:"studyuup"}) MATCH (p:Person{username:"wkolcz"})
WITH m,l,g,p
MERGE (g)-[:CREATED {rating:0}]->(m)
MERGE (m)-[:MEETUP_AT {rating:0}]->(l)-[:HOSTED_MEETUP]->(m)
MERGE (m)<-[:ATTENDING]-(p)
RETURN id(m) as meeting_id
I am getting:
Node 416 already exists with label Location and property "address"=[36350 Van Dyke Ave]
You've encountered a common misunderstanding of MERGE. MERGE merges on everything you've specified within the single MERGE clause. So the order of operations are:
Search for a :Location node with all of the properties you've specified.
If found, return the node.
If not found, create the node.
Your problem occurs at step 3. Because a node with all of the properties you've specified does not exist, it goes to step 3 and tries to create a node with all of those properties. That's when your uniqueness constraint is violated.
The best practice is to merge on the property that you've constrained to be unique and then use SET to update the other properties. In your case:
MERGE (l:Location {address:"36350 Van Dyke Ave"})
SET l.location_name = "Starbucks",
l.city = "Sterling Heights"
...
The same logic is going to apply for the relationships you're merging later in the query. If the entire pattern doesn't exist, it's going to try to create the entire pattern. That's why you should stick to the best practice of:
MERGE (node1:Label1 {unique_property: "value"})
MERGE (node2:Label2 {unique_property: "value"})
MERGE (node1)-[:REL]-(node2)
My graph is a directed tree an each branch along the tree has a unique label for each of the nodes. For example all the nodes in branch 1 have label:branch 1 and all the nodes in branch 2 have label:'branch 2'. The root node (node 0) has both labels: branch 1:branch 2
What is the CYPHER query to list all the node IDs in branch 1 starting from the root node in sequence to the last node (using the label:'branch 1' to find the matching nodes). I.e., for each node listed, it and the node immediately before must also have label 'branch 1`.
If I understand you right you're not actually using Neo4j 2.0 :Label labels on your nodes, but a property called label on your relationships? If so a general query could be something like
START root=node(0)
MATCH path=root<-[rels:IS_BEFORE*1..100]-leaf
WHERE ALL(rel in rels WHERE rel.label = "branch 1")
RETURN EXTRACT(n in nodes(path) | ID(n)) as nodeIdSequence
This is probably not very efficient since it matches all branches and only limits the result to the relevant branch afterwards. It would be more efficient to identify the branch by relationship type, something like (root)-[:NEXT_ON_BRANCH_1]->(branchNode). Alternatively you could do the match in two steps: 1) match the first node on each branch and find the right branch. 2) Now that you know you have the right branch, match the rest of it. You could try something like
START root=node(0)
MATCH root<-[r:IS_BEFORE]-branch
WHERE r.label = "branch 1"
WITH branch
MATCH path=branch<-[:IS_BEFORE*1..100]-leaf
RETURN EXTRACT(n in nodes(path) | ID(n)) as nodeIdSequence
If this is not what your model looks like, please share sample data at http://console.neo4j.org
(Depth limit *1..100 above is arbitrary, set it to whatever you want, but usually setting some limit is a good idea.)