Skip to content

Commit

Permalink
refactor: don't add purge as remote when upgrading (react-native-comm…
Browse files Browse the repository at this point in the history
  • Loading branch information
pvinis authored and dratwas committed Jul 12, 2019
1 parent 03e57b2 commit 03831cf
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 12 deletions.
6 changes: 0 additions & 6 deletions packages/cli/src/commands/upgrade/__tests__/upgrade.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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(
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
6 changes: 0 additions & 6 deletions packages/cli/src/commands/upgrade/upgrade.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,6 @@ async function upgrade(argv: Array<string>, 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(
Expand Down Expand Up @@ -215,8 +213,6 @@ async function upgrade(argv: Array<string>, 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);
Expand Down Expand Up @@ -245,8 +241,6 @@ async function upgrade(argv: Array<string>, 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(
Expand Down

0 comments on commit 03831cf

Please sign in to comment.