Skip to content

Not parsing combined diffs correctlyΒ #23

@ishepard

Description

@ishepard

Hi @cscorley !
I was looking for a tool to parse combined diff to use inside my tool (https://github.com/ishepard/pydriller), and ended up here. In your documentation you state you can parse the combined diff (-c or --cc option), however I am not able to obtain complete results. Let's make an example. I have this combined diff:

cc5b002a5140e2d60184de42554a8737981c846c
diff --cc tests/Microsoft.AspNet.SignalR.FunctionalTests/Client/HubProxyFacts.cs
index aaad4c4a,8bf42fc3..4979ab7d
--- a/tests/Microsoft.AspNet.SignalR.FunctionalTests/Client/HubProxyFacts.cs
+++ b/tests/Microsoft.AspNet.SignalR.FunctionalTests/Client/HubProxyFacts.cs
@@@ -36,11 -36,9 +37,11 @@@ namespace Microsoft.AspNet.SignalR.Test
  
                  hubConnection.Start(host.Transport).Wait();
  
-                 proxy.Invoke("Send", "hello").Wait();
+                 proxy.InvokeWithTimeout("Send", "hello");
  
 -                Assert.True(wh.WaitOne(TimeSpan.FromSeconds(5)));
 +                Assert.True(wh.WaitOne(TimeSpan.FromSeconds(10)));
 +
 +                hubConnection.Stop();
              }
          }
  
@@@ -65,9 -63,9 +66,9 @@@
  
                  hubConnection.Start(host.Transport).Wait();
  
-                 proxy.Invoke("Send", "hello").Wait();
+                 proxy.InvokeWithTimeout("Send", "hello");
  
 -                Assert.True(wh.WaitOne(TimeSpan.FromSeconds(5)));
 +                Assert.True(wh.WaitOne(TimeSpan.FromSeconds(10)));
              }
          }
  
diff --cc tests/Microsoft.AspNet.SignalR.FunctionalTests/Server/Hubs/HubFacts.cs
index d153740f,4bdad4db..393a1ebf
--- a/tests/Microsoft.AspNet.SignalR.FunctionalTests/Server/Hubs/HubFacts.cs
+++ b/tests/Microsoft.AspNet.SignalR.FunctionalTests/Server/Hubs/HubFacts.cs
@@@ -297,8 -291,10 +298,8 @@@ namespace Microsoft.AspNet.SignalR.Test
                      Name = "David"
                  };
  
-                 var person1 = hub.Invoke<SignalR.Samples.Hubs.DemoHub.DemoHub.Person>("ComplexType", person).Result;
+                 var person1 = hub.InvokeWithTimeout<SignalR.Samples.Hubs.DemoHub.DemoHub.Person>("ComplexType", person);
                  var person2 = hub.GetValue<SignalR.Samples.Hubs.DemoHub.DemoHub.Person>("person");
 -                JObject obj = ((dynamic)hub).person;
 -                var person3 = obj.ToObject<SignalR.Samples.Hubs.DemoHub.DemoHub.Person>();
  
                  Assert.NotNull(person1);
                  Assert.NotNull(person2);

If I run:

for diff in whatthepatch.parse_patch(text):
    pprint(diff)

I obtain:

diff(header=header(index_path=None, old_path='--cc', old_version=None, new_path='tests/Microsoft.AspNet.SignalR.FunctionalTests/Client/HubProxyFacts.cs', new_version=None), changes=None, text='diff --cc tests/Microsoft.AspNet.SignalR.FunctionalTests/Client/HubProxyFacts.cs\nindex aaad4c4a,8bf42fc3..4979ab7d\n--- a/tests/Microsoft.AspNet.SignalR.FunctionalTests/Client/HubProxyFacts.cs\n+++ b/tests/Microsoft.AspNet.SignalR.FunctionalTests/Client/HubProxyFacts.cs\n@@@ -36,11 -36,9 +37,11 @@@ namespace Microsoft.AspNet.SignalR.Test\n  \n                  hubConnection.Start(host.Transport).Wait();\n  \n-                 proxy.Invoke("Send", "hello").Wait();\n+                 proxy.InvokeWithTimeout("Send", "hello");\n  \n -                Assert.True(wh.WaitOne(TimeSpan.FromSeconds(5)));\n +                Assert.True(wh.WaitOne(TimeSpan.FromSeconds(10)));\n +\n +                hubConnection.Stop();\n              }\n          }\n  \n@@@ -65,9 -63,9 +66,9 @@@\n  \n                  hubConnection.Start(host.Transport).Wait();\n  \n-                 proxy.Invoke("Send", "hello").Wait();\n+                 proxy.InvokeWithTimeout("Send", "hello");\n  \n -                Assert.True(wh.WaitOne(TimeSpan.FromSeconds(5)));\n +                Assert.True(wh.WaitOne(TimeSpan.FromSeconds(10)));\n              }\n          }\n  \n')
diff(header=header(index_path=None, old_path='--cc', old_version=None, new_path='tests/Microsoft.AspNet.SignalR.FunctionalTests/Server/Hubs/HubFacts.cs', new_version=None), changes=None, text='diff --cc tests/Microsoft.AspNet.SignalR.FunctionalTests/Server/Hubs/HubFacts.cs\nindex d153740f,4bdad4db..393a1ebf\n--- a/tests/Microsoft.AspNet.SignalR.FunctionalTests/Server/Hubs/HubFacts.cs\n+++ b/tests/Microsoft.AspNet.SignalR.FunctionalTests/Server/Hubs/HubFacts.cs\n@@@ -297,8 -291,10 +298,8 @@@ namespace Microsoft.AspNet.SignalR.Test\n                      Name = "David"\n                  };\n  \n-                 var person1 = hub.Invoke<SignalR.Samples.Hubs.DemoHub.DemoHub.Person>("ComplexType", person).Result;\n+                 var person1 = hub.InvokeWithTimeout<SignalR.Samples.Hubs.DemoHub.DemoHub.Person>("ComplexType", person);\n                  var person2 = hub.GetValue<SignalR.Samples.Hubs.DemoHub.DemoHub.Person>("person");\n -                JObject obj = ((dynamic)hub).person;\n -                var person3 = obj.ToObject<SignalR.Samples.Hubs.DemoHub.DemoHub.Person>();\n  \n                  Assert.NotNull(person1);\n                  Assert.NotNull(person2);\n')

As you can see, old_path is "--cc", that doesn't make sense, and changes are always None.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions