Repository: conan-io/conan

Issue:
[bug] Unhelpful error message about conflicting package versions between requires and build_requires
Having conflicting version overrides for the same package in build_requires and requires results in the following output: `ERROR: True`. This makes the error hard to find. The error message should be more helpful on what is going wrong.

#4753 might be related.

### Environment Details (include every applicable attribute)
  * Operating System+version: Arch Linux Kernel 5.12.12
  * Conan version: 1.40.0
  * Python version: 3.9.5

### Steps to reproduce (Include if Applicable)
Try to `conan install` this example conanfile.txt:

```
[requires]
libdeflate/1.7
[build_requires]
libdeflate/1.8
```

### Logs (Executed commands with output) (Include/Attach if Applicable)

```$ conan install conanfile.txt
Configuration:
[settings]
arch=x86_64
build_type=Release
compiler=clang
compiler.cppstd=20
compiler.libcxx=libstdc++11
compiler.version=12
os=Linux
[options]
[build_requires]
[env]

ERROR: True
```

[bug] Unhelpful error message about conflicting package versions between requires and build_requires
Having conflicting version overrides for the same package in build_requires and requires results in the following output: `ERROR: True`. This makes the error hard to find. The error message should be more helpful on what is going wrong.

#4753 might be related.

### Environment Details (include every applicable attribute)
  * Operating System+version: Arch Linux Kernel 5.12.12
  * Conan version: 1.40.0
  * Python version: 3.9.5

### Steps to reproduce (Include if Applicable)
Try to `conan install` this example conanfile.txt:

```
[requires]
libdeflate/1.7
[build_requires]
libdeflate/1.8
```

### Logs (Executed commands with output) (Include/Attach if Applicable)

```$ conan install conanfile.txt
Configuration:
[settings]
arch=x86_64
build_type=Release
compiler=clang
compiler.cppstd=20
compiler.libcxx=libstdc++11
compiler.version=12
os=Linux
[options]
[build_requires]
[env]

ERROR: True
```



Discussion:

Resolving patch:
diff --git a/conans/client/graph/graph_builder.py b/conans/client/graph/graph_builder.py
--- a/conans/client/graph/graph_builder.py
+++ b/conans/client/graph/graph_builder.py
@@ -328,7 +328,8 @@ def _conflicting_references(previous, new_ref, consumer_ref=None):
                         "in your root package."
                         % (consumer_ref, consumer_ref, new_ref, next(iter(previous.dependants)).src,
                            previous.ref, new_ref.name))
-            return True
+            return "Unresolvable conflict between {} and {}".format(previous.ref, new_ref)
+
         # Computed node, if is Editable, has revision=None
         # If new_ref.revision is None we cannot assume any conflict, the user hasn't specified
         # a revision, so it's ok any previous_ref


Test patch:
diff --git a/conans/test/integration/graph/conflict_diamond_test.py b/conans/test/integration/graph/conflict_diamond_test.py
--- a/conans/test/integration/graph/conflict_diamond_test.py
+++ b/conans/test/integration/graph/conflict_diamond_test.py
@@ -4,6 +4,7 @@
 
 from conans.client.tools import environment_append
 from conans.paths import CONANFILE
+from conans.test.assets.genconanfile import GenConanfile
 from conans.test.utils.tools import TestClient, load
 import json
 
@@ -97,3 +98,18 @@ def test_override_explicit(self):
             self.assertEqual(hello0["reference"], "Hello0/0.1@lasote/stable")
             self.assertListEqual(sorted(hello0["required_by"]),
                                  sorted(["Hello2/0.1@lasote/stable", "Hello1/0.1@lasote/stable"]))
+
+
+def test_conflict_msg():
+    c = TestClient()
+    c.save({"lib/conanfile.py": GenConanfile(),
+            "conanfile.txt":  textwrap.dedent("""
+                                [requires]
+                                libdeflate/1.7
+                                [build_requires]
+                                libdeflate/1.8
+                                """)})
+    c.run("export lib libdeflate/1.7@")
+    c.run("export lib libdeflate/1.8@")
+    c.run("install .", assert_error=True)
+    assert "ERROR: Unresolvable conflict between libdeflate/1.7 and libdeflate/1.8" in c.out