From 03831cf30144488bf4c94f56ceb58b586a2be1aa Mon Sep 17 00:00:00 2001 From: Pavlos Vinieratos Date: Sun, 17 Mar 2019 18:04:27 +0100 Subject: [PATCH] refactor: don't add purge as remote when upgrading (#245) --- packages/cli/src/commands/upgrade/__tests__/upgrade.test.js | 6 ------ packages/cli/src/commands/upgrade/upgrade.js | 6 ------ 2 files changed, 12 deletions(-) diff --git a/packages/cli/src/commands/upgrade/__tests__/upgrade.test.js b/packages/cli/src/commands/upgrade/__tests__/upgrade.test.js index 2935afcd00..2ae9d7df9a 100644 --- a/packages/cli/src/commands/upgrade/__tests__/upgrade.test.js +++ b/packages/cli/src/commands/upgrade/__tests__/upgrade.test.js @@ -126,8 +126,6 @@ test('fetches regular patch, adds remote, applies patch, installs deps, removes expect(flushOutput()).toMatchInlineSnapshot(` "info Fetching diff between v0.57.8 and v0.58.4... [fs] write tmp-upgrade-rn.patch -$ execa git remote add tmp-rn-diff-purge https://github.com/react-native-community/rn-diff-purge.git -$ execa git fetch --no-tags tmp-rn-diff-purge $ execa git apply --check tmp-upgrade-rn.patch --exclude=package.json -p2 --3way info Applying diff... $ execa git apply tmp-upgrade-rn.patch --exclude=package.json -p2 --3way @@ -141,7 +139,6 @@ $ execa git add yarn.lock $ execa git add package-lock.json info Running \\"git status\\" to check what changed... $ execa git status -$ execa git remote remove tmp-rn-diff-purge success Upgraded React Native to v0.58.4 🎉. Now you can review and commit the changes" `); expect( @@ -177,8 +174,6 @@ test('cleans up if patching fails,', async () => { expect(flushOutput()).toMatchInlineSnapshot(` "info Fetching diff between v0.57.8 and v0.58.4... [fs] write tmp-upgrade-rn.patch -$ execa git remote add tmp-rn-diff-purge https://github.com/react-native-community/rn-diff-purge.git -$ execa git fetch --no-tags tmp-rn-diff-purge $ execa git apply --check tmp-upgrade-rn.patch --exclude=package.json -p2 --3way info Applying diff (excluding: package.json, .flowconfig)... $ execa git apply tmp-upgrade-rn.patch --exclude=package.json --exclude=.flowconfig -p2 --3way @@ -187,7 +182,6 @@ error Automatically applying diff failed [fs] unlink tmp-upgrade-rn.patch $ execa git status -s error Patch failed to apply for unknown reason. Please fall back to manual way of upgrading -$ execa git remote remove tmp-rn-diff-purge info You may find these resources helpful: • Release notes: https://github.com/facebook/react-native/releases/tag/v0.58.4 • Comparison between versions: https://github.com/react-native-community/rn-diff-purge/compare/version/0.57.8..version/0.58.4 diff --git a/packages/cli/src/commands/upgrade/upgrade.js b/packages/cli/src/commands/upgrade/upgrade.js index b30dbf6f54..aead25ac8d 100644 --- a/packages/cli/src/commands/upgrade/upgrade.js +++ b/packages/cli/src/commands/upgrade/upgrade.js @@ -178,8 +178,6 @@ async function upgrade(argv: Array, ctx: ContextT, args: FlagsT) { if (args.legacy) { return legacyUpgrade.func(argv, ctx); } - const rnDiffGitAddress = `${rnDiffPurgeUrl}.git`; - const tmpRemote = 'tmp-rn-diff-purge'; const tmpPatchFile = 'tmp-upgrade-rn.patch'; const projectDir = ctx.root; const {version: currentVersion} = require(path.join( @@ -215,8 +213,6 @@ async function upgrade(argv: Array, ctx: ContextT, args: FlagsT) { try { fs.writeFileSync(tmpPatchFile, patch); - await execa('git', ['remote', 'add', tmpRemote, rnDiffGitAddress]); - await execa('git', ['fetch', '--no-tags', tmpRemote]); patchSuccess = await applyPatch(currentVersion, newVersion, tmpPatchFile); } catch (error) { throw new Error(error.stderr || error); @@ -245,8 +241,6 @@ async function upgrade(argv: Array, ctx: ContextT, args: FlagsT) { logger.info('Running "git status" to check what changed...'); await execa('git', ['status'], {stdio: 'inherit'}); } - await execa('git', ['remote', 'remove', tmpRemote]); - if (!patchSuccess) { if (stdout) { logger.warn(