{"action":"created","comment":{"url":"https://api.github.com/repos/uberfire/uberfire/pulls/comments/81963624","pull_request_review_id":2903585,"id":81963624,"diff_hunk":"@@ -0,0 +1,110 @@\n+package org.uberfire.java.nio.fs.jgit;\n+\n+import java.io.File;\n+import java.io.IOException;\n+import java.net.URI;\n+import java.util.HashMap;\n+import java.util.List;\n+import java.util.Map;\n+\n+import org.eclipse.jgit.api.Git;\n+import org.eclipse.jgit.lib.Repository;\n+import org.junit.Test;\n+import org.slf4j.Logger;\n+import org.slf4j.LoggerFactory;\n+import org.uberfire.java.nio.base.FileDiff;\n+import org.uberfire.java.nio.file.Path;\n+import org.uberfire.java.nio.fs.jgit.util.JGitUtil;\n+\n+import static org.fest.assertions.api.Assertions.*;\n+import static org.uberfire.java.nio.fs.jgit.util.JGitUtil.*;\n+\n+public class JGitFileSystemProviderDiffTest extends AbstractTestInfra {\n+\n+    private Logger logger = LoggerFactory.getLogger( JGitFileSystemProviderDiffTest.class );\n+\n+    @Test\n+    public void testDiffsBetweenBranches() throws IOException {\n+\n+        final File parentFolder = createTempDirectory();\n+\n+        final File gitSource = new File( parentFolder, \"repo.git\" );\n+        final Git origin = JGitUtil.newRepository( gitSource, true );\n+        final Repository gitRepo = origin.getRepository();\n+\n+        commit( origin, \"master\", \"name\", \"name@example.com\", \"master-1\", null, null, false, new HashMap<String, File>() {{\n+            put( \"file1.txt\", tempFile( \"temp1\\ntemp1\\ntemp3\\nmiddle\\nmoremiddle\\nmoremiddle\\nmoremiddle\\nother\\n\" ) );\n+        }} );\n+\n+        createBranch( origin, \"master\", \"develop\" );\n+\n+        commit( origin, \"develop\", \"name\", \"name@example.com\", \"develop-1\", null, null, false, new HashMap<String, File>() {{\n+            put( \"file1.txt\", tempFile( \"temp1\\ntemp2\\nmiddle\\nmoremiddle\\nmoremiddle\\nmoremiddle\\n\" ) );\n+        }} );\n+\n+        commit( origin, \"develop\", \"name\", \"name@example.com\", \"develop-2\", null, null, false, new HashMap<String, File>() {{\n+            put( \"file3.txt\", tempFile( \"temp3\" ) );\n+        }} );\n+\n+        commit( origin, \"develop\", \"name\", \"name@example.com\", \"develop-3\", null, null, false, new HashMap<String, File>() {{\n+            put( \"file4.txt\", tempFile( \"temp4\" ) );\n+        }} );\n+\n+        commit( origin, \"develop\", \"name\", \"name@example.com\", \"develop-4\", null, null, false, new HashMap<String, File>() {{\n+            put( \"file5.txt\", tempFile( \"temp5\" ) );\n+        }} );\n+\n+        final URI newRepo = URI.create( \"git://diff-repo\" );\n+\n+        final Map<String, Object> env = new HashMap<String, Object>() {{\n+            put( JGitFileSystemProvider.GIT_ENV_KEY_DEFAULT_REMOTE_NAME, origin.getRepository().getDirectory().toString() );\n+        }};\n+\n+        provider.newFileSystem( newRepo, env );\n+\n+        final Path path = provider.getPath( newRepo );\n+        final List<FileDiff> diffs = (List<FileDiff>) provider.readAttributes( path, \"diff:master,develop\" ).get( \"diff\" );\n+\n+        diffs.forEach( elem -> logger.info( elem.toString() ) );\n+\n+        assertThat( diffs.size() ).isEqualTo( 5 );\n+\n+    }\n+\n+    @Test\n+    public void testBranchesDoNotHaveDifferences() throws IOException {\n+\n+        final File parentFolder = createTempDirectory();\n+\n+        final File gitSource = new File( parentFolder, \"repo.git\" );\n+        final Git origin = JGitUtil.newRepository( gitSource, true );\n+        final Repository gitRepo = origin.getRepository();\n+\n+        commit( origin, \"master\", \"name\", \"name@example.com\", \"master-1\", null, null, false, new HashMap<String, File>() {{\n+            put( \"file1.txt\", tempFile( \"temp1\\ntemp1\\ntemp3\\nmiddle\\nmoremiddle\\nmoremiddle\\nmoremiddle\\nother\\n\" ) );\n+        }} );\n+\n+        commit( origin, \"master\", \"name\", \"name@example.com\", \"develop-1\", null, null, false, new HashMap<String, File>() {{\n+            put( \"file1.txt\", tempFile( \"temp1\\ntemp2\\nmiddle\\nmoremiddle\\nmoremiddle\\nmoremiddle\\n\" ) );\n+        }} );\n+\n+        createBranch( origin, \"master\", \"develop\" );\n+\n+        final URI newRepo = URI.create( \"git://diff-repo\" );\n+\n+        final Map<String, Object> env = new HashMap<String, Object>() {{\n+            put( JGitFileSystemProvider.GIT_ENV_KEY_DEFAULT_REMOTE_NAME, origin.getRepository().getDirectory().toString() );\n+        }};\n+\n+        provider.newFileSystem( newRepo, env );\n+\n+        final Path path = provider.getPath( newRepo );\n+        final List<FileDiff> diffs = (List<FileDiff>) provider.readAttributes( path, \"diff:master,develop\" ).get( \"diff\" );\n+\n+        diffs.forEach( elem -> logger.info( elem.toString() ) );\n+\n+        assertThat( diffs.size() ).isEqualTo( 0 );\n+\n+    }\n+\n+}","path":"uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/JGitFileSystemProviderDiffTest.java","position":110,"original_position":110,"commit_id":"ad0c7d643a0088d8762a275b4727399e74ae1d44","original_commit_id":"ad0c7d643a0088d8762a275b4727399e74ae1d44","user":{"login":"porcelli","id":119395,"avatar_url":"https://avatars.githubusercontent.com/u/119395?v=3","gravatar_id":"","url":"https://api.github.com/users/porcelli","html_url":"https://github.com/porcelli","followers_url":"https://api.github.com/users/porcelli/followers","following_url":"https://api.github.com/users/porcelli/following{/other_user}","gists_url":"https://api.github.com/users/porcelli/gists{/gist_id}","starred_url":"https://api.github.com/users/porcelli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/porcelli/subscriptions","organizations_url":"https://api.github.com/users/porcelli/orgs","repos_url":"https://api.github.com/users/porcelli/repos","events_url":"https://api.github.com/users/porcelli/events{/privacy}","received_events_url":"https://api.github.com/users/porcelli/received_events","type":"User","site_admin":false},"body":"missing binary files (ie. image) to check behavior","created_at":"2016-10-05T12:46:36Z","updated_at":"2016-10-05T12:46:36Z","html_url":"https://github.com/uberfire/uberfire/pull/524#discussion_r81963624","pull_request_url":"https://api.github.com/repos/uberfire/uberfire/pulls/524","_links":{"self":{"href":"https://api.github.com/repos/uberfire/uberfire/pulls/comments/81963624"},"html":{"href":"https://github.com/uberfire/uberfire/pull/524#discussion_r81963624"},"pull_request":{"href":"https://api.github.com/repos/uberfire/uberfire/pulls/524"}}},"pull_request":{"url":"https://api.github.com/repos/uberfire/uberfire/pulls/524","id":88004282,"html_url":"https://github.com/uberfire/uberfire/pull/524","diff_url":"https://github.com/uberfire/uberfire/pull/524.diff","patch_url":"https://github.com/uberfire/uberfire/pull/524.patch","issue_url":"https://api.github.com/repos/uberfire/uberfire/issues/524","number":524,"state":"open","locked":false,"title":"[UF-408]: Pull Request feature, Merge, Diff capabilities addded","user":{"login":"adrielparedes","id":471656,"avatar_url":"https://avatars.githubusercontent.com/u/471656?v=3","gravatar_id":"","url":"https://api.github.com/users/adrielparedes","html_url":"https://github.com/adrielparedes","followers_url":"https://api.github.com/users/adrielparedes/followers","following_url":"https://api.github.com/users/adrielparedes/following{/other_user}","gists_url":"https://api.github.com/users/adrielparedes/gists{/gist_id}","starred_url":"https://api.github.com/users/adrielparedes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adrielparedes/subscriptions","organizations_url":"https://api.github.com/users/adrielparedes/orgs","repos_url":"https://api.github.com/users/adrielparedes/repos","events_url":"https://api.github.com/users/adrielparedes/events{/privacy}","received_events_url":"https://api.github.com/users/adrielparedes/received_events","type":"User","site_admin":false},"body":"* Merge command added based on Cherry Pick command. It's implemented on JGitFileSystemProvider.copy method.\r\n* Diff between branches command added. Is implemented in JGitFileSystem.readAttributes method\r\n\r\nIt provides these low level methods to be used into Pull Request Service in Guvnor.","created_at":"2016-10-05T01:48:49Z","updated_at":"2016-10-05T12:48:48Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ab7baeb5cc07d52b46a98cd4ea01d7873bbc17be","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/uberfire/uberfire/pulls/524/commits","review_comments_url":"https://api.github.com/repos/uberfire/uberfire/pulls/524/comments","review_comment_url":"https://api.github.com/repos/uberfire/uberfire/pulls/comments{/number}","comments_url":"https://api.github.com/repos/uberfire/uberfire/issues/524/comments","statuses_url":"https://api.github.com/repos/uberfire/uberfire/statuses/ad0c7d643a0088d8762a275b4727399e74ae1d44","head":{"label":"adrielparedes:UF-408","ref":"UF-408","sha":"ad0c7d643a0088d8762a275b4727399e74ae1d44","user":{"login":"adrielparedes","id":471656,"avatar_url":"https://avatars.githubusercontent.com/u/471656?v=3","gravatar_id":"","url":"https://api.github.com/users/adrielparedes","html_url":"https://github.com/adrielparedes","followers_url":"https://api.github.com/users/adrielparedes/followers","following_url":"https://api.github.com/users/adrielparedes/following{/other_user}","gists_url":"https://api.github.com/users/adrielparedes/gists{/gist_id}","starred_url":"https://api.github.com/users/adrielparedes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adrielparedes/subscriptions","organizations_url":"https://api.github.com/users/adrielparedes/orgs","repos_url":"https://api.github.com/users/adrielparedes/repos","events_url":"https://api.github.com/users/adrielparedes/events{/privacy}","received_events_url":"https://api.github.com/users/adrielparedes/received_events","type":"User","site_admin":false},"repo":{"id":63978192,"name":"uberfire","full_name":"adrielparedes/uberfire","owner":{"login":"adrielparedes","id":471656,"avatar_url":"https://avatars.githubusercontent.com/u/471656?v=3","gravatar_id":"","url":"https://api.github.com/users/adrielparedes","html_url":"https://github.com/adrielparedes","followers_url":"https://api.github.com/users/adrielparedes/followers","following_url":"https://api.github.com/users/adrielparedes/following{/other_user}","gists_url":"https://api.github.com/users/adrielparedes/gists{/gist_id}","starred_url":"https://api.github.com/users/adrielparedes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adrielparedes/subscriptions","organizations_url":"https://api.github.com/users/adrielparedes/orgs","repos_url":"https://api.github.com/users/adrielparedes/repos","events_url":"https://api.github.com/users/adrielparedes/events{/privacy}","received_events_url":"https://api.github.com/users/adrielparedes/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/adrielparedes/uberfire","description":"UberFire Framework","fork":true,"url":"https://api.github.com/repos/adrielparedes/uberfire","forks_url":"https://api.github.com/repos/adrielparedes/uberfire/forks","keys_url":"https://api.github.com/repos/adrielparedes/uberfire/keys{/key_id}","collaborators_url":"https://api.github.com/repos/adrielparedes/uberfire/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/adrielparedes/uberfire/teams","hooks_url":"https://api.github.com/repos/adrielparedes/uberfire/hooks","issue_events_url":"https://api.github.com/repos/adrielparedes/uberfire/issues/events{/number}","events_url":"https://api.github.com/repos/adrielparedes/uberfire/events","assignees_url":"https://api.github.com/repos/adrielparedes/uberfire/assignees{/user}","branches_url":"https://api.github.com/repos/adrielparedes/uberfire/branches{/branch}","tags_url":"https://api.github.com/repos/adrielparedes/uberfire/tags","blobs_url":"https://api.github.com/repos/adrielparedes/uberfire/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/adrielparedes/uberfire/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/adrielparedes/uberfire/git/refs{/sha}","trees_url":"https://api.github.com/repos/adrielparedes/uberfire/git/trees{/sha}","statuses_url":"https://api.github.com/repos/adrielparedes/uberfire/statuses/{sha}","languages_url":"https://api.github.com/repos/adrielparedes/uberfire/languages","stargazers_url":"https://api.github.com/repos/adrielparedes/uberfire/stargazers","contributors_url":"https://api.github.com/repos/adrielparedes/uberfire/contributors","subscribers_url":"https://api.github.com/repos/adrielparedes/uberfire/subscribers","subscription_url":"https://api.github.com/repos/adrielparedes/uberfire/subscription","commits_url":"https://api.github.com/repos/adrielparedes/uberfire/commits{/sha}","git_commits_url":"https://api.github.com/repos/adrielparedes/uberfire/git/commits{/sha}","comments_url":"https://api.github.com/repos/adrielparedes/uberfire/comments{/number}","issue_comment_url":"https://api.github.com/repos/adrielparedes/uberfire/issues/comments{/number}","contents_url":"https://api.github.com/repos/adrielparedes/uberfire/contents/{+path}","compare_url":"https://api.github.com/repos/adrielparedes/uberfire/compare/{base}...{head}","merges_url":"https://api.github.com/repos/adrielparedes/uberfire/merges","archive_url":"https://api.github.com/repos/adrielparedes/uberfire/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/adrielparedes/uberfire/downloads","issues_url":"https://api.github.com/repos/adrielparedes/uberfire/issues{/number}","pulls_url":"https://api.github.com/repos/adrielparedes/uberfire/pulls{/number}","milestones_url":"https://api.github.com/repos/adrielparedes/uberfire/milestones{/number}","notifications_url":"https://api.github.com/repos/adrielparedes/uberfire/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/adrielparedes/uberfire/labels{/name}","releases_url":"https://api.github.com/repos/adrielparedes/uberfire/releases{/id}","deployments_url":"https://api.github.com/repos/adrielparedes/uberfire/deployments","created_at":"2016-07-22T19:28:36Z","updated_at":"2016-07-22T19:28:47Z","pushed_at":"2016-10-05T01:44:12Z","git_url":"git://github.com/adrielparedes/uberfire.git","ssh_url":"git@github.com:adrielparedes/uberfire.git","clone_url":"https://github.com/adrielparedes/uberfire.git","svn_url":"https://github.com/adrielparedes/uberfire","homepage":"http://www.uberfireframework.org","size":35839,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"uberfire:master","ref":"master","sha":"e687f94674350ebbd10c7f94d0d8705965a44782","user":{"login":"uberfire","id":5167699,"avatar_url":"https://avatars.githubusercontent.com/u/5167699?v=3","gravatar_id":"","url":"https://api.github.com/users/uberfire","html_url":"https://github.com/uberfire","followers_url":"https://api.github.com/users/uberfire/followers","following_url":"https://api.github.com/users/uberfire/following{/other_user}","gists_url":"https://api.github.com/users/uberfire/gists{/gist_id}","starred_url":"https://api.github.com/users/uberfire/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/uberfire/subscriptions","organizations_url":"https://api.github.com/users/uberfire/orgs","repos_url":"https://api.github.com/users/uberfire/repos","events_url":"https://api.github.com/users/uberfire/events{/privacy}","received_events_url":"https://api.github.com/users/uberfire/received_events","type":"Organization","site_admin":false},"repo":{"id":4335576,"name":"uberfire","full_name":"uberfire/uberfire","owner":{"login":"uberfire","id":5167699,"avatar_url":"https://avatars.githubusercontent.com/u/5167699?v=3","gravatar_id":"","url":"https://api.github.com/users/uberfire","html_url":"https://github.com/uberfire","followers_url":"https://api.github.com/users/uberfire/followers","following_url":"https://api.github.com/users/uberfire/following{/other_user}","gists_url":"https://api.github.com/users/uberfire/gists{/gist_id}","starred_url":"https://api.github.com/users/uberfire/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/uberfire/subscriptions","organizations_url":"https://api.github.com/users/uberfire/orgs","repos_url":"https://api.github.com/users/uberfire/repos","events_url":"https://api.github.com/users/uberfire/events{/privacy}","received_events_url":"https://api.github.com/users/uberfire/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/uberfire/uberfire","description":"Uberfire Framework","fork":false,"url":"https://api.github.com/repos/uberfire/uberfire","forks_url":"https://api.github.com/repos/uberfire/uberfire/forks","keys_url":"https://api.github.com/repos/uberfire/uberfire/keys{/key_id}","collaborators_url":"https://api.github.com/repos/uberfire/uberfire/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/uberfire/uberfire/teams","hooks_url":"https://api.github.com/repos/uberfire/uberfire/hooks","issue_events_url":"https://api.github.com/repos/uberfire/uberfire/issues/events{/number}","events_url":"https://api.github.com/repos/uberfire/uberfire/events","assignees_url":"https://api.github.com/repos/uberfire/uberfire/assignees{/user}","branches_url":"https://api.github.com/repos/uberfire/uberfire/branches{/branch}","tags_url":"https://api.github.com/repos/uberfire/uberfire/tags","blobs_url":"https://api.github.com/repos/uberfire/uberfire/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/uberfire/uberfire/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/uberfire/uberfire/git/refs{/sha}","trees_url":"https://api.github.com/repos/uberfire/uberfire/git/trees{/sha}","statuses_url":"https://api.github.com/repos/uberfire/uberfire/statuses/{sha}","languages_url":"https://api.github.com/repos/uberfire/uberfire/languages","stargazers_url":"https://api.github.com/repos/uberfire/uberfire/stargazers","contributors_url":"https://api.github.com/repos/uberfire/uberfire/contributors","subscribers_url":"https://api.github.com/repos/uberfire/uberfire/subscribers","subscription_url":"https://api.github.com/repos/uberfire/uberfire/subscription","commits_url":"https://api.github.com/repos/uberfire/uberfire/commits{/sha}","git_commits_url":"https://api.github.com/repos/uberfire/uberfire/git/commits{/sha}","comments_url":"https://api.github.com/repos/uberfire/uberfire/comments{/number}","issue_comment_url":"https://api.github.com/repos/uberfire/uberfire/issues/comments{/number}","contents_url":"https://api.github.com/repos/uberfire/uberfire/contents/{+path}","compare_url":"https://api.github.com/repos/uberfire/uberfire/compare/{base}...{head}","merges_url":"https://api.github.com/repos/uberfire/uberfire/merges","archive_url":"https://api.github.com/repos/uberfire/uberfire/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/uberfire/uberfire/downloads","issues_url":"https://api.github.com/repos/uberfire/uberfire/issues{/number}","pulls_url":"https://api.github.com/repos/uberfire/uberfire/pulls{/number}","milestones_url":"https://api.github.com/repos/uberfire/uberfire/milestones{/number}","notifications_url":"https://api.github.com/repos/uberfire/uberfire/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/uberfire/uberfire/labels{/name}","releases_url":"https://api.github.com/repos/uberfire/uberfire/releases{/id}","deployments_url":"https://api.github.com/repos/uberfire/uberfire/deployments","created_at":"2012-05-15T12:40:55Z","updated_at":"2016-09-27T06:22:41Z","pushed_at":"2016-10-05T08:58:38Z","git_url":"git://github.com/uberfire/uberfire.git","ssh_url":"git@github.com:uberfire/uberfire.git","clone_url":"https://github.com/uberfire/uberfire.git","svn_url":"https://github.com/uberfire/uberfire","homepage":"http://www.uberfireframework.org","size":42713,"stargazers_count":67,"watchers_count":67,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":103,"mirror_url":null,"open_issues_count":4,"forks":103,"open_issues":4,"watchers":67,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/uberfire/uberfire/pulls/524"},"html":{"href":"https://github.com/uberfire/uberfire/pull/524"},"issue":{"href":"https://api.github.com/repos/uberfire/uberfire/issues/524"},"comments":{"href":"https://api.github.com/repos/uberfire/uberfire/issues/524/comments"},"review_comments":{"href":"https://api.github.com/repos/uberfire/uberfire/pulls/524/comments"},"review_comment":{"href":"https://api.github.com/repos/uberfire/uberfire/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/uberfire/uberfire/pulls/524/commits"},"statuses":{"href":"https://api.github.com/repos/uberfire/uberfire/statuses/ad0c7d643a0088d8762a275b4727399e74ae1d44"}}}}
{"actor":{"display_login":"porcelli"}}