{"action":"created","comment":{"url":"https://api.github.com/repos/spotify/snakebite/pulls/comments/23130379","id":23130379,"diff_hunk":"@@ -393,6 +394,60 @@ def _handle_rename(self, path, node, dst):\n         response = self.service.rename(request)\n         return {\"path\": path, \"result\": response.result}\n \n+\n+    def rename_dont_move(self, path, dst, overwriteDest=False):\n+        ''' Rename (but don't move) path to a destination\n+\n+        Since you can't move with this operation, and only rename, it would\n+        not make sense to pass multiple paths to rename to a single\n+        destination. This method uses the underlying rename2 method.\n+\n+        https://github.com/apache/hadoop/blob/ae91b13/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/ClientProtocol.java#L483-L523\n+\n+        This method only wraps the FileAlreadyExistsException exception\n+        (both for the Java FileAlreadyExistsException error and for \"rename\n+        destination directory is not empty\" when overwriteDest=True). The other\n+        exceptions will just be passed along.\n+\n+        :param path: Source path\n+        :type path: string\n+        :param dst: destination\n+        :type dst: string\n+        :returns: A dictionary or None\n+        '''\n+        if not path:\n+            raise InvalidInputException(\"rename_dont_move: no path given\")\n+        if not dst:\n+            raise InvalidInputException(\"rename_dont_move: no destination given\")\n+\n+        processor = lambda path, node, dst=dst, overwriteDest=overwriteDest: self._handle_rename2(path, node, dst, overwriteDest)\n+        for item in self._find_items([path], processor, include_toplevel=True):\n+            return item\n+\n+\n+    def _handle_rename2(self, path, node, dst, overwriteDest):\n+        if not dst.startswith(\"/\"):","path":"snakebite/client.py","position":44,"original_position":44,"commit_id":"daa04ec72ba015c8cef6b6c72940a2475b9c384d","original_commit_id":"daa04ec72ba015c8cef6b6c72940a2475b9c384d","user":{"login":"ravwojdyla","id":1419010,"avatar_url":"https://avatars.githubusercontent.com/u/1419010?v=3","gravatar_id":"","url":"https://api.github.com/users/ravwojdyla","html_url":"https://github.com/ravwojdyla","followers_url":"https://api.github.com/users/ravwojdyla/followers","following_url":"https://api.github.com/users/ravwojdyla/following{/other_user}","gists_url":"https://api.github.com/users/ravwojdyla/gists{/gist_id}","starred_url":"https://api.github.com/users/ravwojdyla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ravwojdyla/subscriptions","organizations_url":"https://api.github.com/users/ravwojdyla/orgs","repos_url":"https://api.github.com/users/ravwojdyla/repos","events_url":"https://api.github.com/users/ravwojdyla/events{/privacy}","received_events_url":"https://api.github.com/users/ravwojdyla/received_events","type":"User","site_admin":false},"body":"Afaik this check is now inside `_find_nodes`","created_at":"2015-01-18T02:50:25Z","updated_at":"2015-01-18T02:50:25Z","html_url":"https://github.com/spotify/snakebite/pull/128#discussion_r23130379","pull_request_url":"https://api.github.com/repos/spotify/snakebite/pulls/128","_links":{"self":{"href":"https://api.github.com/repos/spotify/snakebite/pulls/comments/23130379"},"html":{"href":"https://github.com/spotify/snakebite/pull/128#discussion_r23130379"},"pull_request":{"href":"https://api.github.com/repos/spotify/snakebite/pulls/128"}}},"pull_request":{"url":"https://api.github.com/repos/spotify/snakebite/pulls/128","id":27351708,"html_url":"https://github.com/spotify/snakebite/pull/128","diff_url":"https://github.com/spotify/snakebite/pull/128.diff","patch_url":"https://github.com/spotify/snakebite/pull/128.patch","issue_url":"https://api.github.com/repos/spotify/snakebite/issues/128","number":128,"state":"open","locked":false,"title":"Add client.rename_dont_move()","user":{"login":"Tarrasch","id":294349,"avatar_url":"https://avatars.githubusercontent.com/u/294349?v=3","gravatar_id":"","url":"https://api.github.com/users/Tarrasch","html_url":"https://github.com/Tarrasch","followers_url":"https://api.github.com/users/Tarrasch/followers","following_url":"https://api.github.com/users/Tarrasch/following{/other_user}","gists_url":"https://api.github.com/users/Tarrasch/gists{/gist_id}","starred_url":"https://api.github.com/users/Tarrasch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Tarrasch/subscriptions","organizations_url":"https://api.github.com/users/Tarrasch/orgs","repos_url":"https://api.github.com/users/Tarrasch/repos","events_url":"https://api.github.com/users/Tarrasch/events{/privacy}","received_events_url":"https://api.github.com/users/Tarrasch/received_events","type":"User","site_admin":false},"body":"This patch adds another `mv`-primitive that is purposefully limited to\r\nonly rename and not moving of files. While this seldom is a problem when\r\ninteractively using the `mv` command. It often causes problems in\r\nproduction environments when multiple programs do something like:\r\n\r\n    mv a dest\r\n    mv b dest  # Should throw error, but creates \"dest/b\" instead\r\n\r\nAlso, we're hoping to forever fix the plethora of luigi issues related\r\nto atomicity in renaming that have arised:\r\n\r\n * https://github.com/spotify/luigi/pull/393\r\n * https://github.com/spotify/luigi/pull/522\r\n * https://github.com/spotify/luigi/pull/557\r\n\r\nAnd also the tons of tickets on Spotify's internal JIRA.","created_at":"2015-01-14T14:08:03Z","updated_at":"2015-01-18T02:50:25Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a8e1810640b3d1c255e826022c48c28d7184d7dc","assignee":null,"milestone":{"url":"https://api.github.com/repos/spotify/snakebite/milestones/2","labels_url":"https://api.github.com/repos/spotify/snakebite/milestones/2/labels","id":904370,"number":2,"title":"v2.5.0","description":"Minor release with:\r\n* support for EMR\r\n* rename2 logic","creator":{"login":"ravwojdyla","id":1419010,"avatar_url":"https://avatars.githubusercontent.com/u/1419010?v=3","gravatar_id":"","url":"https://api.github.com/users/ravwojdyla","html_url":"https://github.com/ravwojdyla","followers_url":"https://api.github.com/users/ravwojdyla/followers","following_url":"https://api.github.com/users/ravwojdyla/following{/other_user}","gists_url":"https://api.github.com/users/ravwojdyla/gists{/gist_id}","starred_url":"https://api.github.com/users/ravwojdyla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ravwojdyla/subscriptions","organizations_url":"https://api.github.com/users/ravwojdyla/orgs","repos_url":"https://api.github.com/users/ravwojdyla/repos","events_url":"https://api.github.com/users/ravwojdyla/events{/privacy}","received_events_url":"https://api.github.com/users/ravwojdyla/received_events","type":"User","site_admin":false},"open_issues":4,"closed_issues":0,"state":"open","created_at":"2014-12-15T15:03:51Z","updated_at":"2015-01-16T09:36:30Z","due_on":"2015-01-30T23:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/spotify/snakebite/pulls/128/commits","review_comments_url":"https://api.github.com/repos/spotify/snakebite/pulls/128/comments","review_comment_url":"https://api.github.com/repos/spotify/snakebite/pulls/comments/{number}","comments_url":"https://api.github.com/repos/spotify/snakebite/issues/128/comments","statuses_url":"https://api.github.com/repos/spotify/snakebite/statuses/daa04ec72ba015c8cef6b6c72940a2475b9c384d","head":{"label":"Tarrasch:rename_dont_move","ref":"rename_dont_move","sha":"daa04ec72ba015c8cef6b6c72940a2475b9c384d","user":{"login":"Tarrasch","id":294349,"avatar_url":"https://avatars.githubusercontent.com/u/294349?v=3","gravatar_id":"","url":"https://api.github.com/users/Tarrasch","html_url":"https://github.com/Tarrasch","followers_url":"https://api.github.com/users/Tarrasch/followers","following_url":"https://api.github.com/users/Tarrasch/following{/other_user}","gists_url":"https://api.github.com/users/Tarrasch/gists{/gist_id}","starred_url":"https://api.github.com/users/Tarrasch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Tarrasch/subscriptions","organizations_url":"https://api.github.com/users/Tarrasch/orgs","repos_url":"https://api.github.com/users/Tarrasch/repos","events_url":"https://api.github.com/users/Tarrasch/events{/privacy}","received_events_url":"https://api.github.com/users/Tarrasch/received_events","type":"User","site_admin":false},"repo":{"id":22684256,"name":"snakebite","full_name":"Tarrasch/snakebite","owner":{"login":"Tarrasch","id":294349,"avatar_url":"https://avatars.githubusercontent.com/u/294349?v=3","gravatar_id":"","url":"https://api.github.com/users/Tarrasch","html_url":"https://github.com/Tarrasch","followers_url":"https://api.github.com/users/Tarrasch/followers","following_url":"https://api.github.com/users/Tarrasch/following{/other_user}","gists_url":"https://api.github.com/users/Tarrasch/gists{/gist_id}","starred_url":"https://api.github.com/users/Tarrasch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Tarrasch/subscriptions","organizations_url":"https://api.github.com/users/Tarrasch/orgs","repos_url":"https://api.github.com/users/Tarrasch/repos","events_url":"https://api.github.com/users/Tarrasch/events{/privacy}","received_events_url":"https://api.github.com/users/Tarrasch/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Tarrasch/snakebite","description":"A pure python HDFS client","fork":true,"url":"https://api.github.com/repos/Tarrasch/snakebite","forks_url":"https://api.github.com/repos/Tarrasch/snakebite/forks","keys_url":"https://api.github.com/repos/Tarrasch/snakebite/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Tarrasch/snakebite/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Tarrasch/snakebite/teams","hooks_url":"https://api.github.com/repos/Tarrasch/snakebite/hooks","issue_events_url":"https://api.github.com/repos/Tarrasch/snakebite/issues/events{/number}","events_url":"https://api.github.com/repos/Tarrasch/snakebite/events","assignees_url":"https://api.github.com/repos/Tarrasch/snakebite/assignees{/user}","branches_url":"https://api.github.com/repos/Tarrasch/snakebite/branches{/branch}","tags_url":"https://api.github.com/repos/Tarrasch/snakebite/tags","blobs_url":"https://api.github.com/repos/Tarrasch/snakebite/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Tarrasch/snakebite/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Tarrasch/snakebite/git/refs{/sha}","trees_url":"https://api.github.com/repos/Tarrasch/snakebite/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Tarrasch/snakebite/statuses/{sha}","languages_url":"https://api.github.com/repos/Tarrasch/snakebite/languages","stargazers_url":"https://api.github.com/repos/Tarrasch/snakebite/stargazers","contributors_url":"https://api.github.com/repos/Tarrasch/snakebite/contributors","subscribers_url":"https://api.github.com/repos/Tarrasch/snakebite/subscribers","subscription_url":"https://api.github.com/repos/Tarrasch/snakebite/subscription","commits_url":"https://api.github.com/repos/Tarrasch/snakebite/commits{/sha}","git_commits_url":"https://api.github.com/repos/Tarrasch/snakebite/git/commits{/sha}","comments_url":"https://api.github.com/repos/Tarrasch/snakebite/comments{/number}","issue_comment_url":"https://api.github.com/repos/Tarrasch/snakebite/issues/comments/{number}","contents_url":"https://api.github.com/repos/Tarrasch/snakebite/contents/{+path}","compare_url":"https://api.github.com/repos/Tarrasch/snakebite/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Tarrasch/snakebite/merges","archive_url":"https://api.github.com/repos/Tarrasch/snakebite/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Tarrasch/snakebite/downloads","issues_url":"https://api.github.com/repos/Tarrasch/snakebite/issues{/number}","pulls_url":"https://api.github.com/repos/Tarrasch/snakebite/pulls{/number}","milestones_url":"https://api.github.com/repos/Tarrasch/snakebite/milestones{/number}","notifications_url":"https://api.github.com/repos/Tarrasch/snakebite/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Tarrasch/snakebite/labels{/name}","releases_url":"https://api.github.com/repos/Tarrasch/snakebite/releases{/id}","created_at":"2014-08-06T13:50:16Z","updated_at":"2014-08-02T09:53:28Z","pushed_at":"2015-01-15T14:04:49Z","git_url":"git://github.com/Tarrasch/snakebite.git","ssh_url":"git@github.com:Tarrasch/snakebite.git","clone_url":"https://github.com/Tarrasch/snakebite.git","svn_url":"https://github.com/Tarrasch/snakebite","homepage":null,"size":4221,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"spotify:master","ref":"master","sha":"75e24b95ede05ff9021363bb7db72db5e9b14ca4","user":{"login":"spotify","id":251374,"avatar_url":"https://avatars.githubusercontent.com/u/251374?v=3","gravatar_id":"","url":"https://api.github.com/users/spotify","html_url":"https://github.com/spotify","followers_url":"https://api.github.com/users/spotify/followers","following_url":"https://api.github.com/users/spotify/following{/other_user}","gists_url":"https://api.github.com/users/spotify/gists{/gist_id}","starred_url":"https://api.github.com/users/spotify/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spotify/subscriptions","organizations_url":"https://api.github.com/users/spotify/orgs","repos_url":"https://api.github.com/users/spotify/repos","events_url":"https://api.github.com/users/spotify/events{/privacy}","received_events_url":"https://api.github.com/users/spotify/received_events","type":"Organization","site_admin":false},"repo":{"id":9908723,"name":"snakebite","full_name":"spotify/snakebite","owner":{"login":"spotify","id":251374,"avatar_url":"https://avatars.githubusercontent.com/u/251374?v=3","gravatar_id":"","url":"https://api.github.com/users/spotify","html_url":"https://github.com/spotify","followers_url":"https://api.github.com/users/spotify/followers","following_url":"https://api.github.com/users/spotify/following{/other_user}","gists_url":"https://api.github.com/users/spotify/gists{/gist_id}","starred_url":"https://api.github.com/users/spotify/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spotify/subscriptions","organizations_url":"https://api.github.com/users/spotify/orgs","repos_url":"https://api.github.com/users/spotify/repos","events_url":"https://api.github.com/users/spotify/events{/privacy}","received_events_url":"https://api.github.com/users/spotify/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/spotify/snakebite","description":"A pure python HDFS client","fork":false,"url":"https://api.github.com/repos/spotify/snakebite","forks_url":"https://api.github.com/repos/spotify/snakebite/forks","keys_url":"https://api.github.com/repos/spotify/snakebite/keys{/key_id}","collaborators_url":"https://api.github.com/repos/spotify/snakebite/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/spotify/snakebite/teams","hooks_url":"https://api.github.com/repos/spotify/snakebite/hooks","issue_events_url":"https://api.github.com/repos/spotify/snakebite/issues/events{/number}","events_url":"https://api.github.com/repos/spotify/snakebite/events","assignees_url":"https://api.github.com/repos/spotify/snakebite/assignees{/user}","branches_url":"https://api.github.com/repos/spotify/snakebite/branches{/branch}","tags_url":"https://api.github.com/repos/spotify/snakebite/tags","blobs_url":"https://api.github.com/repos/spotify/snakebite/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/spotify/snakebite/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/spotify/snakebite/git/refs{/sha}","trees_url":"https://api.github.com/repos/spotify/snakebite/git/trees{/sha}","statuses_url":"https://api.github.com/repos/spotify/snakebite/statuses/{sha}","languages_url":"https://api.github.com/repos/spotify/snakebite/languages","stargazers_url":"https://api.github.com/repos/spotify/snakebite/stargazers","contributors_url":"https://api.github.com/repos/spotify/snakebite/contributors","subscribers_url":"https://api.github.com/repos/spotify/snakebite/subscribers","subscription_url":"https://api.github.com/repos/spotify/snakebite/subscription","commits_url":"https://api.github.com/repos/spotify/snakebite/commits{/sha}","git_commits_url":"https://api.github.com/repos/spotify/snakebite/git/commits{/sha}","comments_url":"https://api.github.com/repos/spotify/snakebite/comments{/number}","issue_comment_url":"https://api.github.com/repos/spotify/snakebite/issues/comments/{number}","contents_url":"https://api.github.com/repos/spotify/snakebite/contents/{+path}","compare_url":"https://api.github.com/repos/spotify/snakebite/compare/{base}...{head}","merges_url":"https://api.github.com/repos/spotify/snakebite/merges","archive_url":"https://api.github.com/repos/spotify/snakebite/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/spotify/snakebite/downloads","issues_url":"https://api.github.com/repos/spotify/snakebite/issues{/number}","pulls_url":"https://api.github.com/repos/spotify/snakebite/pulls{/number}","milestones_url":"https://api.github.com/repos/spotify/snakebite/milestones{/number}","notifications_url":"https://api.github.com/repos/spotify/snakebite/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/spotify/snakebite/labels{/name}","releases_url":"https://api.github.com/repos/spotify/snakebite/releases{/id}","created_at":"2013-05-07T09:44:13Z","updated_at":"2015-01-16T17:44:40Z","pushed_at":"2015-01-14T09:51:44Z","git_url":"git://github.com/spotify/snakebite.git","ssh_url":"git@github.com:spotify/snakebite.git","clone_url":"https://github.com/spotify/snakebite.git","svn_url":"https://github.com/spotify/snakebite","homepage":null,"size":6359,"stargazers_count":243,"watchers_count":243,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":52,"mirror_url":null,"open_issues_count":26,"forks":52,"open_issues":26,"watchers":243,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/spotify/snakebite/pulls/128"},"html":{"href":"https://github.com/spotify/snakebite/pull/128"},"issue":{"href":"https://api.github.com/repos/spotify/snakebite/issues/128"},"comments":{"href":"https://api.github.com/repos/spotify/snakebite/issues/128/comments"},"review_comments":{"href":"https://api.github.com/repos/spotify/snakebite/pulls/128/comments"},"review_comment":{"href":"https://api.github.com/repos/spotify/snakebite/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/spotify/snakebite/pulls/128/commits"},"statuses":{"href":"https://api.github.com/repos/spotify/snakebite/statuses/daa04ec72ba015c8cef6b6c72940a2475b9c384d"}}}}