Page MenuHomePhabricator

D4703.id.diff
No OneTemporary

D4703.id.diff

diff --git a/scripts/generate-phab-tag-removal-script.js b/scripts/generate-phab-tag-removal-script.js
--- a/scripts/generate-phab-tag-removal-script.js
+++ b/scripts/generate-phab-tag-removal-script.js
@@ -1,5 +1,6 @@
// @flow
+const { execSync } = require('child_process');
const fs = require('fs');
const { request } = require('gaxios');
@@ -31,13 +32,18 @@
return revisionsToBeRemoved;
};
-const getGitTagsToBeRemoved = revisionsToBeRemoved => {
+const getRemoteGitTags = () => {
+ const remoteGitTags = execSync('git tag');
+ return new Set(remoteGitTags.toString().split('\n'));
+};
+
+const getGitTagsToBeRemoved = (remoteGitTags, revisionsToBeRemoved) => {
const gitTagsToBeRemoved = [];
for (const revisionID of revisionsToBeRemoved) {
gitTagsToBeRemoved.push(`phabricator/base/${revisionID}`);
gitTagsToBeRemoved.push(`phabricator/diff/${revisionID}`);
}
- return gitTagsToBeRemoved;
+ return gitTagsToBeRemoved.filter(tag => remoteGitTags.has(tag));
};
const getGitCommandsToBeRun = gitTagsToBeRemoved => {
@@ -50,8 +56,12 @@
async function main() {
const differentialData = await getDifferentialDataFromPhabricator();
+ const remoteGitTags = getRemoteGitTags();
const revisionsToBeRemoved = getRevisionsToBeRemoved(differentialData);
- const gitTagsToBeRemoved = getGitTagsToBeRemoved(revisionsToBeRemoved);
+ const gitTagsToBeRemoved = getGitTagsToBeRemoved(
+ remoteGitTags,
+ revisionsToBeRemoved,
+ );
const gitCommandsToBeRun = getGitCommandsToBeRun(gitTagsToBeRemoved);
writeGitCommandsScriptToDisk(gitCommandsToBeRun);
process.exit(0);

File Metadata

Mime Type
text/plain
Expires
Sat, Oct 5, 11:37 PM (8 h, 40 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2246848
Default Alt Text
D4703.id.diff (1 KB)

Event Timeline