{"action":"created","comment":{"url":"https://api.github.com/repos/Microsoft/vsts-rm-extensions/pulls/comments/195871031","pull_request_review_id":129328450,"id":195871031,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5NTg3MTAzMQ==","diff_hunk":"@@ -0,0 +1,102 @@\n+import * as fs from 'fs';\n+import * as path from 'path';\n+import * as readline from 'readline';\n+import { resolve } from 'url';;\n+var crypto = require('crypto');\n+\n+var tl = require('vsts-task-lib/task');\n+\n+import * as models from '../Models';\n+import { ArtifactItemStore } from '../Store/artifactItemStore';\n+import { Logger } from '../Engine/logger';\n+\n+export class CacheProvider implements models.IArtifactProvider {\n+\n+    public artifactItemStore: ArtifactItemStore;\n+    \n+    constructor(artifactCacheDirectory: string, artifactCacheKey: string, relPath?: string) {\n+        this.artifactCacheDirectory = artifactCacheDirectory;\n+        this.key = crypto.createHash('SHA256').update(artifactCacheKey).digest('hex');\n+        this.relPath = relPath ? relPath : '';\n+        this.cacheDirectory = path.join(artifactCacheDirectory, \"ArtifactEngineCache\", this.key);\n+        this.cacheHashPath = path.join(this.cacheDirectory , 'artifact-metadata.csv');\n+        this.makeOldHash()\n+    }\n+\n+    getRootItems(): Promise<models.ArtifactItem[]> {\n+        throw new Error(\"Not implemented\");\n+    }\n+\n+    getArtifactItems(artifactItem: models.ArtifactItem): Promise<models.ArtifactItem[]> {\n+        throw new Error(\"Not implemented\");\n+    }\n+\n+    getArtifactItem(artifactItem: models.ArtifactItem): Promise<NodeJS.ReadableStream> {\n+        var promise = new Promise<NodeJS.ReadableStream> ((resolve,reject) => {\n+            if(artifactItem.fileHash && artifactItem.fileHash === this.oldFileHashMap[artifactItem.path.substring(this.relPath.length+1)]) {\n+                const inputStream = fs.createReadStream(path.join(this.artifactCacheDirectory,\"ArtifactEngineCache\", this.key, artifactItem.path.substring(this.relPath.length+1)));\n+                inputStream.on('error',(err) => {\n+                    throw err;\n+                })\n+                resolve(inputStream);\n+            }\n+            else \n+                resolve(undefined);    \n+        });\n+        return promise;\n+    }\n+\n+    public putArtifactItem(item: models.ArtifactItem, stream: NodeJS.ReadableStream): Promise<models.ArtifactItem> {\n+        throw new Error(\"Not implemented\");\n+    }\n+\n+    public getRootLocation(): string {\n+        throw new Error(\"Not implemented\");\n+    }\n+\n+    public getRootItemPath(): string {\n+        throw new Error(\"Not implemented\");\n+    }\n+\n+    dispose(): void {\n+    }\n+    \n+    public makeOldHash() : void  {\n+        if(fs.existsSync(path.join(this.artifactCacheDirectory,\"ArtifactEngineCache\",this.key,\"verify.json\"))) {\n+            if(fs.existsSync(this.cacheHashPath)) {\n+                var oldHash = readline.createInterface ({\n+                    input : fs.createReadStream(this.cacheHashPath)\n+                });\n+        \n+                oldHash.on('line', (line) => {\n+                    var words = line.split(',');\n+                    this.oldFileHashMap[words[0]] = words[1];\n+                });\n+        \n+                oldHash.on('close', () => {    \n+                    Logger.logMessage(\"Cache Successfully Initialised.\")\n+                });\n+            }\n+            else {\n+                this.oldFileHashMap = {};\n+                Logger.logMessage(\"artifact-metadata.csv not found\")\n+            }\n+        }\n+        else {\n+            this.oldFileHashMap = {}\n+            Logger.logMessage(\"Cache is not verified or present\");\n+        }\n+        ","path":"Extensions/ArtifactEngine/Providers/cacheProvider.ts","position":89,"original_position":89,"commit_id":"8222bb657d6f39f8124ffa04fa1b4ad3a12c6a8d","original_commit_id":"8222bb657d6f39f8124ffa04fa1b4ad3a12c6a8d","user":{"login":"omeshp","id":11783897,"node_id":"MDQ6VXNlcjExNzgzODk3","avatar_url":"https://avatars2.githubusercontent.com/u/11783897?v=4","gravatar_id":"","url":"https://api.github.com/users/omeshp","html_url":"https://github.com/omeshp","followers_url":"https://api.github.com/users/omeshp/followers","following_url":"https://api.github.com/users/omeshp/following{/other_user}","gists_url":"https://api.github.com/users/omeshp/gists{/gist_id}","starred_url":"https://api.github.com/users/omeshp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/omeshp/subscriptions","organizations_url":"https://api.github.com/users/omeshp/orgs","repos_url":"https://api.github.com/users/omeshp/repos","events_url":"https://api.github.com/users/omeshp/events{/privacy}","received_events_url":"https://api.github.com/users/omeshp/received_events","type":"User","site_admin":false},"body":"remove extra blank lines","created_at":"2018-06-15T21:56:15Z","updated_at":"2018-06-15T21:56:15Z","html_url":"https://github.com/Microsoft/vsts-rm-extensions/pull/446#discussion_r195871031","pull_request_url":"https://api.github.com/repos/Microsoft/vsts-rm-extensions/pulls/446","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/Microsoft/vsts-rm-extensions/pulls/comments/195871031"},"html":{"href":"https://github.com/Microsoft/vsts-rm-extensions/pull/446#discussion_r195871031"},"pull_request":{"href":"https://api.github.com/repos/Microsoft/vsts-rm-extensions/pulls/446"}}},"pull_request":{"url":"https://api.github.com/repos/Microsoft/vsts-rm-extensions/pulls/446","id":194595579,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk0NTk1NTc5","html_url":"https://github.com/Microsoft/vsts-rm-extensions/pull/446","diff_url":"https://github.com/Microsoft/vsts-rm-extensions/pull/446.diff","patch_url":"https://github.com/Microsoft/vsts-rm-extensions/pull/446.patch","issue_url":"https://api.github.com/repos/Microsoft/vsts-rm-extensions/issues/446","number":446,"state":"open","locked":false,"title":"Changes for Incremental Download","user":{"login":"deep2696","id":33370767,"node_id":"MDQ6VXNlcjMzMzcwNzY3","avatar_url":"https://avatars0.githubusercontent.com/u/33370767?v=4","gravatar_id":"","url":"https://api.github.com/users/deep2696","html_url":"https://github.com/deep2696","followers_url":"https://api.github.com/users/deep2696/followers","following_url":"https://api.github.com/users/deep2696/following{/other_user}","gists_url":"https://api.github.com/users/deep2696/gists{/gist_id}","starred_url":"https://api.github.com/users/deep2696/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/deep2696/subscriptions","organizations_url":"https://api.github.com/users/deep2696/orgs","repos_url":"https://api.github.com/users/deep2696/repos","events_url":"https://api.github.com/users/deep2696/events{/privacy}","received_events_url":"https://api.github.com/users/deep2696/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-06-13T13:56:57Z","updated_at":"2018-06-15T21:56:15Z","closed_at":null,"merged_at":null,"merge_commit_sha":"210106ecfd5365036a9176141672762800d46992","assignee":null,"assignees":[],"requested_reviewers":[{"login":"GitHubSriramB","id":13654692,"node_id":"MDQ6VXNlcjEzNjU0Njky","avatar_url":"https://avatars2.githubusercontent.com/u/13654692?v=4","gravatar_id":"","url":"https://api.github.com/users/GitHubSriramB","html_url":"https://github.com/GitHubSriramB","followers_url":"https://api.github.com/users/GitHubSriramB/followers","following_url":"https://api.github.com/users/GitHubSriramB/following{/other_user}","gists_url":"https://api.github.com/users/GitHubSriramB/gists{/gist_id}","starred_url":"https://api.github.com/users/GitHubSriramB/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GitHubSriramB/subscriptions","organizations_url":"https://api.github.com/users/GitHubSriramB/orgs","repos_url":"https://api.github.com/users/GitHubSriramB/repos","events_url":"https://api.github.com/users/GitHubSriramB/events{/privacy}","received_events_url":"https://api.github.com/users/GitHubSriramB/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/Microsoft/vsts-rm-extensions/pulls/446/commits","review_comments_url":"https://api.github.com/repos/Microsoft/vsts-rm-extensions/pulls/446/comments","review_comment_url":"https://api.github.com/repos/Microsoft/vsts-rm-extensions/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Microsoft/vsts-rm-extensions/issues/446/comments","statuses_url":"https://api.github.com/repos/Microsoft/vsts-rm-extensions/statuses/8222bb657d6f39f8124ffa04fa1b4ad3a12c6a8d","head":{"label":"deep2696:master","ref":"master","sha":"8222bb657d6f39f8124ffa04fa1b4ad3a12c6a8d","user":{"login":"deep2696","id":33370767,"node_id":"MDQ6VXNlcjMzMzcwNzY3","avatar_url":"https://avatars0.githubusercontent.com/u/33370767?v=4","gravatar_id":"","url":"https://api.github.com/users/deep2696","html_url":"https://github.com/deep2696","followers_url":"https://api.github.com/users/deep2696/followers","following_url":"https://api.github.com/users/deep2696/following{/other_user}","gists_url":"https://api.github.com/users/deep2696/gists{/gist_id}","starred_url":"https://api.github.com/users/deep2696/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/deep2696/subscriptions","organizations_url":"https://api.github.com/users/deep2696/orgs","repos_url":"https://api.github.com/users/deep2696/repos","events_url":"https://api.github.com/users/deep2696/events{/privacy}","received_events_url":"https://api.github.com/users/deep2696/received_events","type":"User","site_admin":false},"repo":{"id":136433742,"node_id":"MDEwOlJlcG9zaXRvcnkxMzY0MzM3NDI=","name":"vsts-rm-extensions","full_name":"deep2696/vsts-rm-extensions","owner":{"login":"deep2696","id":33370767,"node_id":"MDQ6VXNlcjMzMzcwNzY3","avatar_url":"https://avatars0.githubusercontent.com/u/33370767?v=4","gravatar_id":"","url":"https://api.github.com/users/deep2696","html_url":"https://github.com/deep2696","followers_url":"https://api.github.com/users/deep2696/followers","following_url":"https://api.github.com/users/deep2696/following{/other_user}","gists_url":"https://api.github.com/users/deep2696/gists{/gist_id}","starred_url":"https://api.github.com/users/deep2696/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/deep2696/subscriptions","organizations_url":"https://api.github.com/users/deep2696/orgs","repos_url":"https://api.github.com/users/deep2696/repos","events_url":"https://api.github.com/users/deep2696/events{/privacy}","received_events_url":"https://api.github.com/users/deep2696/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/deep2696/vsts-rm-extensions","description":"Collection of all RM and deployment extensions","fork":true,"url":"https://api.github.com/repos/deep2696/vsts-rm-extensions","forks_url":"https://api.github.com/repos/deep2696/vsts-rm-extensions/forks","keys_url":"https://api.github.com/repos/deep2696/vsts-rm-extensions/keys{/key_id}","collaborators_url":"https://api.github.com/repos/deep2696/vsts-rm-extensions/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/deep2696/vsts-rm-extensions/teams","hooks_url":"https://api.github.com/repos/deep2696/vsts-rm-extensions/hooks","issue_events_url":"https://api.github.com/repos/deep2696/vsts-rm-extensions/issues/events{/number}","events_url":"https://api.github.com/repos/deep2696/vsts-rm-extensions/events","assignees_url":"https://api.github.com/repos/deep2696/vsts-rm-extensions/assignees{/user}","branches_url":"https://api.github.com/repos/deep2696/vsts-rm-extensions/branches{/branch}","tags_url":"https://api.github.com/repos/deep2696/vsts-rm-extensions/tags","blobs_url":"https://api.github.com/repos/deep2696/vsts-rm-extensions/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/deep2696/vsts-rm-extensions/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/deep2696/vsts-rm-extensions/git/refs{/sha}","trees_url":"https://api.github.com/repos/deep2696/vsts-rm-extensions/git/trees{/sha}","statuses_url":"https://api.github.com/repos/deep2696/vsts-rm-extensions/statuses/{sha}","languages_url":"https://api.github.com/repos/deep2696/vsts-rm-extensions/languages","stargazers_url":"https://api.github.com/repos/deep2696/vsts-rm-extensions/stargazers","contributors_url":"https://api.github.com/repos/deep2696/vsts-rm-extensions/contributors","subscribers_url":"https://api.github.com/repos/deep2696/vsts-rm-extensions/subscribers","subscription_url":"https://api.github.com/repos/deep2696/vsts-rm-extensions/subscription","commits_url":"https://api.github.com/repos/deep2696/vsts-rm-extensions/commits{/sha}","git_commits_url":"https://api.github.com/repos/deep2696/vsts-rm-extensions/git/commits{/sha}","comments_url":"https://api.github.com/repos/deep2696/vsts-rm-extensions/comments{/number}","issue_comment_url":"https://api.github.com/repos/deep2696/vsts-rm-extensions/issues/comments{/number}","contents_url":"https://api.github.com/repos/deep2696/vsts-rm-extensions/contents/{+path}","compare_url":"https://api.github.com/repos/deep2696/vsts-rm-extensions/compare/{base}...{head}","merges_url":"https://api.github.com/repos/deep2696/vsts-rm-extensions/merges","archive_url":"https://api.github.com/repos/deep2696/vsts-rm-extensions/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/deep2696/vsts-rm-extensions/downloads","issues_url":"https://api.github.com/repos/deep2696/vsts-rm-extensions/issues{/number}","pulls_url":"https://api.github.com/repos/deep2696/vsts-rm-extensions/pulls{/number}","milestones_url":"https://api.github.com/repos/deep2696/vsts-rm-extensions/milestones{/number}","notifications_url":"https://api.github.com/repos/deep2696/vsts-rm-extensions/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/deep2696/vsts-rm-extensions/labels{/name}","releases_url":"https://api.github.com/repos/deep2696/vsts-rm-extensions/releases{/id}","deployments_url":"https://api.github.com/repos/deep2696/vsts-rm-extensions/deployments","created_at":"2018-06-07T06:42:35Z","updated_at":"2018-06-15T14:09:40Z","pushed_at":"2018-06-15T14:09:37Z","git_url":"git://github.com/deep2696/vsts-rm-extensions.git","ssh_url":"git@github.com:deep2696/vsts-rm-extensions.git","clone_url":"https://github.com/deep2696/vsts-rm-extensions.git","svn_url":"https://github.com/deep2696/vsts-rm-extensions","homepage":"http://www.visualstudio.com/explore/release-management-vs","size":5160,"stargazers_count":0,"watchers_count":0,"language":"PowerShell","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"Microsoft:master","ref":"master","sha":"84d84ce637c85c98fe37816fefceaa41525e2275","user":{"login":"Microsoft","id":6154722,"node_id":"MDEyOk9yZ2FuaXphdGlvbjYxNTQ3MjI=","avatar_url":"https://avatars2.githubusercontent.com/u/6154722?v=4","gravatar_id":"","url":"https://api.github.com/users/Microsoft","html_url":"https://github.com/Microsoft","followers_url":"https://api.github.com/users/Microsoft/followers","following_url":"https://api.github.com/users/Microsoft/following{/other_user}","gists_url":"https://api.github.com/users/Microsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/Microsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Microsoft/subscriptions","organizations_url":"https://api.github.com/users/Microsoft/orgs","repos_url":"https://api.github.com/users/Microsoft/repos","events_url":"https://api.github.com/users/Microsoft/events{/privacy}","received_events_url":"https://api.github.com/users/Microsoft/received_events","type":"Organization","site_admin":false},"repo":{"id":55225846,"node_id":"MDEwOlJlcG9zaXRvcnk1NTIyNTg0Ng==","name":"vsts-rm-extensions","full_name":"Microsoft/vsts-rm-extensions","owner":{"login":"Microsoft","id":6154722,"node_id":"MDEyOk9yZ2FuaXphdGlvbjYxNTQ3MjI=","avatar_url":"https://avatars2.githubusercontent.com/u/6154722?v=4","gravatar_id":"","url":"https://api.github.com/users/Microsoft","html_url":"https://github.com/Microsoft","followers_url":"https://api.github.com/users/Microsoft/followers","following_url":"https://api.github.com/users/Microsoft/following{/other_user}","gists_url":"https://api.github.com/users/Microsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/Microsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Microsoft/subscriptions","organizations_url":"https://api.github.com/users/Microsoft/orgs","repos_url":"https://api.github.com/users/Microsoft/repos","events_url":"https://api.github.com/users/Microsoft/events{/privacy}","received_events_url":"https://api.github.com/users/Microsoft/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Microsoft/vsts-rm-extensions","description":"Collection of all RM and deployment extensions","fork":false,"url":"https://api.github.com/repos/Microsoft/vsts-rm-extensions","forks_url":"https://api.github.com/repos/Microsoft/vsts-rm-extensions/forks","keys_url":"https://api.github.com/repos/Microsoft/vsts-rm-extensions/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Microsoft/vsts-rm-extensions/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Microsoft/vsts-rm-extensions/teams","hooks_url":"https://api.github.com/repos/Microsoft/vsts-rm-extensions/hooks","issue_events_url":"https://api.github.com/repos/Microsoft/vsts-rm-extensions/issues/events{/number}","events_url":"https://api.github.com/repos/Microsoft/vsts-rm-extensions/events","assignees_url":"https://api.github.com/repos/Microsoft/vsts-rm-extensions/assignees{/user}","branches_url":"https://api.github.com/repos/Microsoft/vsts-rm-extensions/branches{/branch}","tags_url":"https://api.github.com/repos/Microsoft/vsts-rm-extensions/tags","blobs_url":"https://api.github.com/repos/Microsoft/vsts-rm-extensions/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Microsoft/vsts-rm-extensions/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Microsoft/vsts-rm-extensions/git/refs{/sha}","trees_url":"https://api.github.com/repos/Microsoft/vsts-rm-extensions/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Microsoft/vsts-rm-extensions/statuses/{sha}","languages_url":"https://api.github.com/repos/Microsoft/vsts-rm-extensions/languages","stargazers_url":"https://api.github.com/repos/Microsoft/vsts-rm-extensions/stargazers","contributors_url":"https://api.github.com/repos/Microsoft/vsts-rm-extensions/contributors","subscribers_url":"https://api.github.com/repos/Microsoft/vsts-rm-extensions/subscribers","subscription_url":"https://api.github.com/repos/Microsoft/vsts-rm-extensions/subscription","commits_url":"https://api.github.com/repos/Microsoft/vsts-rm-extensions/commits{/sha}","git_commits_url":"https://api.github.com/repos/Microsoft/vsts-rm-extensions/git/commits{/sha}","comments_url":"https://api.github.com/repos/Microsoft/vsts-rm-extensions/comments{/number}","issue_comment_url":"https://api.github.com/repos/Microsoft/vsts-rm-extensions/issues/comments{/number}","contents_url":"https://api.github.com/repos/Microsoft/vsts-rm-extensions/contents/{+path}","compare_url":"https://api.github.com/repos/Microsoft/vsts-rm-extensions/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Microsoft/vsts-rm-extensions/merges","archive_url":"https://api.github.com/repos/Microsoft/vsts-rm-extensions/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Microsoft/vsts-rm-extensions/downloads","issues_url":"https://api.github.com/repos/Microsoft/vsts-rm-extensions/issues{/number}","pulls_url":"https://api.github.com/repos/Microsoft/vsts-rm-extensions/pulls{/number}","milestones_url":"https://api.github.com/repos/Microsoft/vsts-rm-extensions/milestones{/number}","notifications_url":"https://api.github.com/repos/Microsoft/vsts-rm-extensions/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Microsoft/vsts-rm-extensions/labels{/name}","releases_url":"https://api.github.com/repos/Microsoft/vsts-rm-extensions/releases{/id}","deployments_url":"https://api.github.com/repos/Microsoft/vsts-rm-extensions/deployments","created_at":"2016-04-01T10:56:59Z","updated_at":"2018-06-14T05:01:54Z","pushed_at":"2018-06-15T14:09:40Z","git_url":"git://github.com/Microsoft/vsts-rm-extensions.git","ssh_url":"git@github.com:Microsoft/vsts-rm-extensions.git","clone_url":"https://github.com/Microsoft/vsts-rm-extensions.git","svn_url":"https://github.com/Microsoft/vsts-rm-extensions","homepage":"http://www.visualstudio.com/explore/release-management-vs","size":5089,"stargazers_count":56,"watchers_count":56,"language":"PowerShell","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":87,"mirror_url":null,"archived":false,"open_issues_count":46,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":87,"open_issues":46,"watchers":56,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Microsoft/vsts-rm-extensions/pulls/446"},"html":{"href":"https://github.com/Microsoft/vsts-rm-extensions/pull/446"},"issue":{"href":"https://api.github.com/repos/Microsoft/vsts-rm-extensions/issues/446"},"comments":{"href":"https://api.github.com/repos/Microsoft/vsts-rm-extensions/issues/446/comments"},"review_comments":{"href":"https://api.github.com/repos/Microsoft/vsts-rm-extensions/pulls/446/comments"},"review_comment":{"href":"https://api.github.com/repos/Microsoft/vsts-rm-extensions/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Microsoft/vsts-rm-extensions/pulls/446/commits"},"statuses":{"href":"https://api.github.com/repos/Microsoft/vsts-rm-extensions/statuses/8222bb657d6f39f8124ffa04fa1b4ad3a12c6a8d"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"omeshp"}}