{"action":"created","comment":{"url":"https://api.github.com/repos/overleaf/writelatex-git-bridge/pulls/comments/77766984","id":77766984,"diff_hunk":"@@ -110,62 +114,109 @@ public void startSwapJob() {\n         swapJob.start();\n     }\n \n-    /* TODO: Remove these when WLBridged is moved into RepoStore */\n-    public void lockForProject(String projectName) {\n-        lock.lockForProject(projectName);\n-    }\n-\n-    public void unlockForProject(String projectName) {\n-        lock.unlockForProject(projectName);\n-    }\n-\n-    public boolean repositoryExists(Credential oauth2, String projectName)\n-            throws ServiceMayNotContinueException, GitUserException {\n-        lockForProject(projectName);\n-        GetDocRequest getDocRequest = new GetDocRequest(oauth2, projectName);\n-        getDocRequest.request();\n-        try {\n+    public boolean projectExists(\n+            Credential oauth2,\n+            String projectName\n+    ) throws ServiceMayNotContinueException,\n+             GitUserException {\n+        try (LockGuard __ = lock.lockGuard(projectName)) {\n+            GetDocRequest getDocRequest = new GetDocRequest(\n+                    oauth2,\n+                    projectName\n+            );\n+            getDocRequest.request();\n             getDocRequest.getResult().getVersionID();\n+            return true;\n         } catch (InvalidProjectException e) {\n             return false;\n-        } finally {\n-            unlockForProject(projectName);\n         }\n-        return true;\n     }\n \n-    public void getWritableRepositories(\n+    public void updateRepository(\n             Credential oauth2,\n             ProjectRepo repo\n-    ) throws IOException,\n-             GitUserException {\n-        Log.info(\"[{}] Fetching\", repo.getProjectName());\n-        updateProjectWithName(oauth2, repo);\n+    ) throws IOException, GitUserException {\n+        String projectName = repo.getProjectName();\n+        try (LockGuard __ = lock.lockGuard(projectName)) {\n+            Log.info(\"[{}] Updating\", projectName);\n+            updateRepositoryCritical(oauth2, repo);\n+        }\n     }\n \n-    public void\n-    putDirectoryContentsToProjectWithName(Credential oauth2,\n-                                          String projectName,\n-                                          RawDirectory directoryContents,\n-                                          RawDirectory oldDirectoryContents,\n-                                          String hostname)\n-            throws SnapshotPostException, IOException, ForbiddenException {\n-        lock.lockForProject(projectName);\n-        CandidateSnapshot candidate = null;\n-        try {\n-            Log.info(\"[{}] Pushing\", projectName);\n-            String postbackKey = postbackManager.makeKeyForProject(projectName);\n-            Log.info(\n-                    \"[{}] Created postback key: {}\",\n+    private void updateRepositoryCritical(","path":"src/main/java/uk/ac/ic/wlgitbridge/bridge/Bridge.java","position":187,"original_position":88,"commit_id":"bcf0ef26c14e62113d5ed4cfa006d4b8f177cd2f","original_commit_id":"b011fd7a7aeadaaf5ce5ef22ae0d49b12df10d31","user":{"login":"mmazour","id":820907,"avatar_url":"https://avatars.githubusercontent.com/u/820907?v=3","gravatar_id":"","url":"https://api.github.com/users/mmazour","html_url":"https://github.com/mmazour","followers_url":"https://api.github.com/users/mmazour/followers","following_url":"https://api.github.com/users/mmazour/following{/other_user}","gists_url":"https://api.github.com/users/mmazour/gists{/gist_id}","starred_url":"https://api.github.com/users/mmazour/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mmazour/subscriptions","organizations_url":"https://api.github.com/users/mmazour/orgs","repos_url":"https://api.github.com/users/mmazour/repos","events_url":"https://api.github.com/users/mmazour/events{/privacy}","received_events_url":"https://api.github.com/users/mmazour/received_events","type":"User","site_admin":false},"body":"Why are these methods named `Critical`?","created_at":"2016-09-07T06:40:04Z","updated_at":"2016-09-07T06:40:04Z","html_url":"https://github.com/overleaf/writelatex-git-bridge/pull/17#discussion_r77766984","pull_request_url":"https://api.github.com/repos/overleaf/writelatex-git-bridge/pulls/17","_links":{"self":{"href":"https://api.github.com/repos/overleaf/writelatex-git-bridge/pulls/comments/77766984"},"html":{"href":"https://github.com/overleaf/writelatex-git-bridge/pull/17#discussion_r77766984"},"pull_request":{"href":"https://api.github.com/repos/overleaf/writelatex-git-bridge/pulls/17"}}},"pull_request":{"url":"https://api.github.com/repos/overleaf/writelatex-git-bridge/pulls/17","id":83019341,"html_url":"https://github.com/overleaf/writelatex-git-bridge/pull/17","diff_url":"https://github.com/overleaf/writelatex-git-bridge/pull/17.diff","patch_url":"https://github.com/overleaf/writelatex-git-bridge/pull/17.patch","issue_url":"https://api.github.com/repos/overleaf/writelatex-git-bridge/issues/17","number":17,"state":"open","locked":false,"title":"v0.5: Upgrade deps, huge refactor, swap store","user":{"login":"winstonli","id":3519080,"avatar_url":"https://avatars.githubusercontent.com/u/3519080?v=3","gravatar_id":"","url":"https://api.github.com/users/winstonli","html_url":"https://github.com/winstonli","followers_url":"https://api.github.com/users/winstonli/followers","following_url":"https://api.github.com/users/winstonli/following{/other_user}","gists_url":"https://api.github.com/users/winstonli/gists{/gist_id}","starred_url":"https://api.github.com/users/winstonli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/winstonli/subscriptions","organizations_url":"https://api.github.com/users/winstonli/orgs","repos_url":"https://api.github.com/users/winstonli/repos","events_url":"https://api.github.com/users/winstonli/events{/privacy}","received_events_url":"https://api.github.com/users/winstonli/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-08-28T15:52:09Z","updated_at":"2016-09-07T06:40:04Z","closed_at":null,"merged_at":null,"merge_commit_sha":"928bb03500dc1a9b144125f1f0c511def3db9415","assignee":{"login":"winstonli","id":3519080,"avatar_url":"https://avatars.githubusercontent.com/u/3519080?v=3","gravatar_id":"","url":"https://api.github.com/users/winstonli","html_url":"https://github.com/winstonli","followers_url":"https://api.github.com/users/winstonli/followers","following_url":"https://api.github.com/users/winstonli/following{/other_user}","gists_url":"https://api.github.com/users/winstonli/gists{/gist_id}","starred_url":"https://api.github.com/users/winstonli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/winstonli/subscriptions","organizations_url":"https://api.github.com/users/winstonli/orgs","repos_url":"https://api.github.com/users/winstonli/repos","events_url":"https://api.github.com/users/winstonli/events{/privacy}","received_events_url":"https://api.github.com/users/winstonli/received_events","type":"User","site_admin":false},"assignees":[{"login":"winstonli","id":3519080,"avatar_url":"https://avatars.githubusercontent.com/u/3519080?v=3","gravatar_id":"","url":"https://api.github.com/users/winstonli","html_url":"https://github.com/winstonli","followers_url":"https://api.github.com/users/winstonli/followers","following_url":"https://api.github.com/users/winstonli/following{/other_user}","gists_url":"https://api.github.com/users/winstonli/gists{/gist_id}","starred_url":"https://api.github.com/users/winstonli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/winstonli/subscriptions","organizations_url":"https://api.github.com/users/winstonli/orgs","repos_url":"https://api.github.com/users/winstonli/repos","events_url":"https://api.github.com/users/winstonli/events{/privacy}","received_events_url":"https://api.github.com/users/winstonli/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/overleaf/writelatex-git-bridge/pulls/17/commits","review_comments_url":"https://api.github.com/repos/overleaf/writelatex-git-bridge/pulls/17/comments","review_comment_url":"https://api.github.com/repos/overleaf/writelatex-git-bridge/pulls/comments{/number}","comments_url":"https://api.github.com/repos/overleaf/writelatex-git-bridge/issues/17/comments","statuses_url":"https://api.github.com/repos/overleaf/writelatex-git-bridge/statuses/bcf0ef26c14e62113d5ed4cfa006d4b8f177cd2f","head":{"label":"overleaf:swapstore","ref":"swapstore","sha":"bcf0ef26c14e62113d5ed4cfa006d4b8f177cd2f","user":{"login":"overleaf","id":6359919,"avatar_url":"https://avatars.githubusercontent.com/u/6359919?v=3","gravatar_id":"","url":"https://api.github.com/users/overleaf","html_url":"https://github.com/overleaf","followers_url":"https://api.github.com/users/overleaf/followers","following_url":"https://api.github.com/users/overleaf/following{/other_user}","gists_url":"https://api.github.com/users/overleaf/gists{/gist_id}","starred_url":"https://api.github.com/users/overleaf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/overleaf/subscriptions","organizations_url":"https://api.github.com/users/overleaf/orgs","repos_url":"https://api.github.com/users/overleaf/repos","events_url":"https://api.github.com/users/overleaf/events{/privacy}","received_events_url":"https://api.github.com/users/overleaf/received_events","type":"Organization","site_admin":false},"repo":{"id":28834984,"name":"writelatex-git-bridge","full_name":"overleaf/writelatex-git-bridge","owner":{"login":"overleaf","id":6359919,"avatar_url":"https://avatars.githubusercontent.com/u/6359919?v=3","gravatar_id":"","url":"https://api.github.com/users/overleaf","html_url":"https://github.com/overleaf","followers_url":"https://api.github.com/users/overleaf/followers","following_url":"https://api.github.com/users/overleaf/following{/other_user}","gists_url":"https://api.github.com/users/overleaf/gists{/gist_id}","starred_url":"https://api.github.com/users/overleaf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/overleaf/subscriptions","organizations_url":"https://api.github.com/users/overleaf/orgs","repos_url":"https://api.github.com/users/overleaf/repos","events_url":"https://api.github.com/users/overleaf/events{/privacy}","received_events_url":"https://api.github.com/users/overleaf/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/overleaf/writelatex-git-bridge","description":"Bridge between WriteLatex and Git.","fork":true,"url":"https://api.github.com/repos/overleaf/writelatex-git-bridge","forks_url":"https://api.github.com/repos/overleaf/writelatex-git-bridge/forks","keys_url":"https://api.github.com/repos/overleaf/writelatex-git-bridge/keys{/key_id}","collaborators_url":"https://api.github.com/repos/overleaf/writelatex-git-bridge/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/overleaf/writelatex-git-bridge/teams","hooks_url":"https://api.github.com/repos/overleaf/writelatex-git-bridge/hooks","issue_events_url":"https://api.github.com/repos/overleaf/writelatex-git-bridge/issues/events{/number}","events_url":"https://api.github.com/repos/overleaf/writelatex-git-bridge/events","assignees_url":"https://api.github.com/repos/overleaf/writelatex-git-bridge/assignees{/user}","branches_url":"https://api.github.com/repos/overleaf/writelatex-git-bridge/branches{/branch}","tags_url":"https://api.github.com/repos/overleaf/writelatex-git-bridge/tags","blobs_url":"https://api.github.com/repos/overleaf/writelatex-git-bridge/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/overleaf/writelatex-git-bridge/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/overleaf/writelatex-git-bridge/git/refs{/sha}","trees_url":"https://api.github.com/repos/overleaf/writelatex-git-bridge/git/trees{/sha}","statuses_url":"https://api.github.com/repos/overleaf/writelatex-git-bridge/statuses/{sha}","languages_url":"https://api.github.com/repos/overleaf/writelatex-git-bridge/languages","stargazers_url":"https://api.github.com/repos/overleaf/writelatex-git-bridge/stargazers","contributors_url":"https://api.github.com/repos/overleaf/writelatex-git-bridge/contributors","subscribers_url":"https://api.github.com/repos/overleaf/writelatex-git-bridge/subscribers","subscription_url":"https://api.github.com/repos/overleaf/writelatex-git-bridge/subscription","commits_url":"https://api.github.com/repos/overleaf/writelatex-git-bridge/commits{/sha}","git_commits_url":"https://api.github.com/repos/overleaf/writelatex-git-bridge/git/commits{/sha}","comments_url":"https://api.github.com/repos/overleaf/writelatex-git-bridge/comments{/number}","issue_comment_url":"https://api.github.com/repos/overleaf/writelatex-git-bridge/issues/comments{/number}","contents_url":"https://api.github.com/repos/overleaf/writelatex-git-bridge/contents/{+path}","compare_url":"https://api.github.com/repos/overleaf/writelatex-git-bridge/compare/{base}...{head}","merges_url":"https://api.github.com/repos/overleaf/writelatex-git-bridge/merges","archive_url":"https://api.github.com/repos/overleaf/writelatex-git-bridge/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/overleaf/writelatex-git-bridge/downloads","issues_url":"https://api.github.com/repos/overleaf/writelatex-git-bridge/issues{/number}","pulls_url":"https://api.github.com/repos/overleaf/writelatex-git-bridge/pulls{/number}","milestones_url":"https://api.github.com/repos/overleaf/writelatex-git-bridge/milestones{/number}","notifications_url":"https://api.github.com/repos/overleaf/writelatex-git-bridge/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/overleaf/writelatex-git-bridge/labels{/name}","releases_url":"https://api.github.com/repos/overleaf/writelatex-git-bridge/releases{/id}","deployments_url":"https://api.github.com/repos/overleaf/writelatex-git-bridge/deployments","created_at":"2015-01-05T22:29:08Z","updated_at":"2016-01-20T08:23:23Z","pushed_at":"2016-09-06T08:15:16Z","git_url":"git://github.com/overleaf/writelatex-git-bridge.git","ssh_url":"git@github.com:overleaf/writelatex-git-bridge.git","clone_url":"https://github.com/overleaf/writelatex-git-bridge.git","svn_url":"https://github.com/overleaf/writelatex-git-bridge","homepage":"","size":23081,"stargazers_count":1,"watchers_count":1,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":1,"default_branch":"master"}},"base":{"label":"overleaf:master","ref":"master","sha":"7e7d3f3ffc5783be69b8a0840a6beff11eaa5680","user":{"login":"overleaf","id":6359919,"avatar_url":"https://avatars.githubusercontent.com/u/6359919?v=3","gravatar_id":"","url":"https://api.github.com/users/overleaf","html_url":"https://github.com/overleaf","followers_url":"https://api.github.com/users/overleaf/followers","following_url":"https://api.github.com/users/overleaf/following{/other_user}","gists_url":"https://api.github.com/users/overleaf/gists{/gist_id}","starred_url":"https://api.github.com/users/overleaf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/overleaf/subscriptions","organizations_url":"https://api.github.com/users/overleaf/orgs","repos_url":"https://api.github.com/users/overleaf/repos","events_url":"https://api.github.com/users/overleaf/events{/privacy}","received_events_url":"https://api.github.com/users/overleaf/received_events","type":"Organization","site_admin":false},"repo":{"id":28834984,"name":"writelatex-git-bridge","full_name":"overleaf/writelatex-git-bridge","owner":{"login":"overleaf","id":6359919,"avatar_url":"https://avatars.githubusercontent.com/u/6359919?v=3","gravatar_id":"","url":"https://api.github.com/users/overleaf","html_url":"https://github.com/overleaf","followers_url":"https://api.github.com/users/overleaf/followers","following_url":"https://api.github.com/users/overleaf/following{/other_user}","gists_url":"https://api.github.com/users/overleaf/gists{/gist_id}","starred_url":"https://api.github.com/users/overleaf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/overleaf/subscriptions","organizations_url":"https://api.github.com/users/overleaf/orgs","repos_url":"https://api.github.com/users/overleaf/repos","events_url":"https://api.github.com/users/overleaf/events{/privacy}","received_events_url":"https://api.github.com/users/overleaf/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/overleaf/writelatex-git-bridge","description":"Bridge between WriteLatex and Git.","fork":true,"url":"https://api.github.com/repos/overleaf/writelatex-git-bridge","forks_url":"https://api.github.com/repos/overleaf/writelatex-git-bridge/forks","keys_url":"https://api.github.com/repos/overleaf/writelatex-git-bridge/keys{/key_id}","collaborators_url":"https://api.github.com/repos/overleaf/writelatex-git-bridge/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/overleaf/writelatex-git-bridge/teams","hooks_url":"https://api.github.com/repos/overleaf/writelatex-git-bridge/hooks","issue_events_url":"https://api.github.com/repos/overleaf/writelatex-git-bridge/issues/events{/number}","events_url":"https://api.github.com/repos/overleaf/writelatex-git-bridge/events","assignees_url":"https://api.github.com/repos/overleaf/writelatex-git-bridge/assignees{/user}","branches_url":"https://api.github.com/repos/overleaf/writelatex-git-bridge/branches{/branch}","tags_url":"https://api.github.com/repos/overleaf/writelatex-git-bridge/tags","blobs_url":"https://api.github.com/repos/overleaf/writelatex-git-bridge/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/overleaf/writelatex-git-bridge/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/overleaf/writelatex-git-bridge/git/refs{/sha}","trees_url":"https://api.github.com/repos/overleaf/writelatex-git-bridge/git/trees{/sha}","statuses_url":"https://api.github.com/repos/overleaf/writelatex-git-bridge/statuses/{sha}","languages_url":"https://api.github.com/repos/overleaf/writelatex-git-bridge/languages","stargazers_url":"https://api.github.com/repos/overleaf/writelatex-git-bridge/stargazers","contributors_url":"https://api.github.com/repos/overleaf/writelatex-git-bridge/contributors","subscribers_url":"https://api.github.com/repos/overleaf/writelatex-git-bridge/subscribers","subscription_url":"https://api.github.com/repos/overleaf/writelatex-git-bridge/subscription","commits_url":"https://api.github.com/repos/overleaf/writelatex-git-bridge/commits{/sha}","git_commits_url":"https://api.github.com/repos/overleaf/writelatex-git-bridge/git/commits{/sha}","comments_url":"https://api.github.com/repos/overleaf/writelatex-git-bridge/comments{/number}","issue_comment_url":"https://api.github.com/repos/overleaf/writelatex-git-bridge/issues/comments{/number}","contents_url":"https://api.github.com/repos/overleaf/writelatex-git-bridge/contents/{+path}","compare_url":"https://api.github.com/repos/overleaf/writelatex-git-bridge/compare/{base}...{head}","merges_url":"https://api.github.com/repos/overleaf/writelatex-git-bridge/merges","archive_url":"https://api.github.com/repos/overleaf/writelatex-git-bridge/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/overleaf/writelatex-git-bridge/downloads","issues_url":"https://api.github.com/repos/overleaf/writelatex-git-bridge/issues{/number}","pulls_url":"https://api.github.com/repos/overleaf/writelatex-git-bridge/pulls{/number}","milestones_url":"https://api.github.com/repos/overleaf/writelatex-git-bridge/milestones{/number}","notifications_url":"https://api.github.com/repos/overleaf/writelatex-git-bridge/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/overleaf/writelatex-git-bridge/labels{/name}","releases_url":"https://api.github.com/repos/overleaf/writelatex-git-bridge/releases{/id}","deployments_url":"https://api.github.com/repos/overleaf/writelatex-git-bridge/deployments","created_at":"2015-01-05T22:29:08Z","updated_at":"2016-01-20T08:23:23Z","pushed_at":"2016-09-06T08:15:16Z","git_url":"git://github.com/overleaf/writelatex-git-bridge.git","ssh_url":"git@github.com:overleaf/writelatex-git-bridge.git","clone_url":"https://github.com/overleaf/writelatex-git-bridge.git","svn_url":"https://github.com/overleaf/writelatex-git-bridge","homepage":"","size":23081,"stargazers_count":1,"watchers_count":1,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/overleaf/writelatex-git-bridge/pulls/17"},"html":{"href":"https://github.com/overleaf/writelatex-git-bridge/pull/17"},"issue":{"href":"https://api.github.com/repos/overleaf/writelatex-git-bridge/issues/17"},"comments":{"href":"https://api.github.com/repos/overleaf/writelatex-git-bridge/issues/17/comments"},"review_comments":{"href":"https://api.github.com/repos/overleaf/writelatex-git-bridge/pulls/17/comments"},"review_comment":{"href":"https://api.github.com/repos/overleaf/writelatex-git-bridge/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/overleaf/writelatex-git-bridge/pulls/17/commits"},"statuses":{"href":"https://api.github.com/repos/overleaf/writelatex-git-bridge/statuses/bcf0ef26c14e62113d5ed4cfa006d4b8f177cd2f"}}}}
{"actor":{"display_login":"mmazour"}}