Why is this a baseless merge in tfs? - tfs

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.

Related

sum 2 graphs in neo4j with multiple MERGE

in brief: how can we MERGE multiple nodes and relations just like the way we do with MATCH and CREATE: we can do multiple CREATE or MATCH for nodes or relations, separated with comma, but this action is not allowed with MERGE
in detail: suppose I have two graphs:
G1: (a)-[r1]->(b)<-[r2]-(c)
G2: (a)-[r1]->(b)<-[r3]-(d)
I have G1 inserted in neo4j, and G2 ready to push to db. The normal way to do it is to merge each node pair and then merge the relation; in this example for r1 relation there would be no change in db, since G1 already has the relation, however for the second one, my CQL first create node d then add relation r3
Is there a way to push G2 to db in one step? something like:
MERGE (a), (b), (c), (a)-[r1]->(b)<-[r3]-(d)
to create such result:
(a)-[r1]->(b)<-[r2]-(c)
^
|
[r3]
|
(d)
Not with a single MERGE statement. You would need to follow the pattern of doing a MERGE for each node, then a MERGE for each relationship.
That said, Neo4j does use transactions, so while this is broken into multiple clauses in your Cypher query, the transaction is applied atomically when committed.

Main branch rollback and merge child branch missing changes

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.

Neo4j: How to speed up a query with multiple merges?

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) )

Using CYPHER to find nodes outside a reporting chain

I have included a picture to make this question easier to undestand.
I have a CYPHER query where I start with Manager A and I want to find out:
a) all the staff that :REPORTS_TO them in the reporting chain. Using diagram, answer: B, C, D, B1, B2, B11, D1, D2
b) who the reports :KNOWS who are not in the reporting chain. Using diagram, answer: Z, W, X
I am able to answer a) but not b) without including C, D1 and D2.
Does anyone who how to solve this problem?
I had try to run a query to find the reports and then pipe the results into a second query using the WITH clause but I have been unable to exclude C, D1 and DC
Object network
I think I found a query that works, though it only returns the nodes outside the reporting chain. It might be difficult to return both a) and b) in the same query.
First, creating the graph (should match your diagram, except I'm using lowercase):
merge (a:Person{name:"a"})
merge (b:Person{name:"b"})
merge (c:Person{name:"c"})
merge (d:Person{name:"d"})
merge (b1:Person{name:"b1"})
merge (b2:Person{name:"b2"})
merge (b11:Person{name:"b11"})
merge (d1:Person{name:"d1"})
merge (d2:Person{name:"d2"})
merge (z:Person{name:"z"})
merge (w:Person{name:"w"})
merge (x:Person{name:"x"})
merge (b)-[:REPORTS_TO]->(a)
merge (c)-[:REPORTS_TO]->(a)
merge (d)-[:REPORTS_TO]->(a)
merge (b1)-[:REPORTS_TO]->(b)
merge (b2)-[:REPORTS_TO]->(b)
merge (b11)-[:REPORTS_TO]->(b1)
merge (d1)-[:REPORTS_TO]->(d)
merge (d2)-[:REPORTS_TO]->(d)
merge (z)-[:KNOWS]->(b)
merge (z)-[:KNOWS]->(b11)
merge (b2)-[:KNOWS]->(w)
merge (b2)-[:KNOWS]->(c)
merge (b2)-[:KNOWS]->(d1)
merge (d1)-[:KNOWS]->(x)
merge (c)-[:KNOWS]->(d2)
Now for the query
MATCH (:Person{name:"a"})<-[:REPORTS_TO*]-(reporter:Person)-[:KNOWS]-(other:Person)
WITH COLLECT(reporter) AS reporters, COLLECT(other) AS others
WITH FILTER (o IN others WHERE NOT o IN reporters) AS outsiders
UNWIND outsiders AS outsider
RETURN DISTINCT outsider
This will return people Z, W, and X. There's probably a more elegant solution, but I haven't stumbled on it yet. Maybe it's hiding in plain sight?

merging nodes into a new one with cypher and neo4j

using Neo4j - Graph Database Kernel 2.0.0-M02 and the new merge function,
I was trying to merge nodes into a new one (merge does not really merges but binds to the returning identifier according to the documentation) and delete old nodes. I only care at the moment about properties to be transferred to the new node and not relationships.
What I have at the moment is the cypher below
merge (n:User {form_id:123}) //I get the nodes with form_id=123 and label User
with n match p=n //subject to change to have the in a collection
create (x) //create a new node
foreach(n in nodes(p): set x=n) //properties of n copied over to x
return n,x
Problems
1. When foreach runs it creates a new x for every n
2. Moving properties from n to x is replacing all properties each time with the new n
so if the 1st n node from merge has 2 properties a,b and the second c,d in the and after the set x=n all new nodes end up with c,d properties. I know is stated in the documentation so my question is:
Is there a way to merge all properties of N number of nodes (and maybe relationships as well) in a new node with cypher only?
I don't think the Cypher language currently has a syntax that non-destructively copies any and all properties from one node into another.
However, I'll present the solution to a simple situation that may be similar to yours. Let's say that some User nodes have the properties a & b, and some others have c & d. For example:
CREATE (:User { id:1,a: 1,b: 2 }),(:User { id:1,c: 3,d: 4 }),
(:User { id:2,a:10,b:20 }),(:User { id:2,c:30,d:40 });
This is how we would "merge" all User nodes with the same id into a single node:
MATCH (x:User), (y:User)
WHERE x.id=y.id AND has(x.a) AND has(y.c)
SET x.c = y.c, x.d = y.d
DELETE y
RETURN x
You can try this out in the neo4j sandbox at: http://console.neo4j.org/
With Neo4j-3.x it is also possible to merge two nodes into one using a specific apoc procedure.
First you need to download the apoc procedures jar file in your into your $NEO4J_HOME/plugins folder and start the Neo4j server.
Then you can call apoc.refactor.mergeNodes this way:
MATCH (x:User), (y:User)
WHERE x.id=y.id
call apoc.refactor.mergeNodes([x,y]) YIELD node
RETURN node
As I can see it, the resulting node would have all the properties of both x and y, choosing the values of y if both are set.

Resources