Skip to content
This repository was archived by the owner on Mar 22, 2020. It is now read-only.

Commit 5f55bca

Browse files
committed
up
1 parent 15c4a36 commit 5f55bca

File tree

3 files changed

+25
-13
lines changed

3 files changed

+25
-13
lines changed

langs/hi.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"name": "Hindi",
3+
"code": "hi",
4+
"maintainers": ["siradityaverma"],
5+
"published": false
6+
}

lib/init/createRepo.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,8 @@ async function setupRepo(langInfo) {
125125
name: newRepoName,
126126
has_projects: false,
127127
has_wiki: false,
128+
homepage: typeof langInfo.published === 'string' ? langInfo.published :
129+
langInfo.published ? `https://${langInfo}.javascript.info` : `https://javascript.info`,
128130
allow_merge_commit: true,
129131
allow_squash_merge: false,
130132
allow_rebase_merge: false

lib/sync.js

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,13 @@ module.exports = async (langInfo) => {
4747

4848
let conflictFiles = await run(`git diff --name-only --diff-filter=U`, {cwd: translatedPath });
4949
conflictFiles = conflictFiles.split('\n');
50-
//
50+
5151
// if (conflictFiles[0] === 'Readme.md' && conflictFiles.length === 1) {
5252
// await run(`git checkout --ours Readme.md`, {cwd: translatedPath });
5353
// await run(`git commit -m 'readme only' Readme.md`, {cwd: translatedPath });
5454
// }
5555

56-
if (conflictFiles[0] === '') conflictFiles.shift(); // if no conflicts, becomes ['']
56+
if (conflictFiles[0] === '') conflictFiles.shift(); // if no conflicts, conflictFiles becomes ['']
5757

5858
if (conflictFiles.length) {
5959
await run(`git commit -am "merging all conflicts"`, {cwd: translatedPath});
@@ -82,6 +82,8 @@ module.exports = async (langInfo) => {
8282
conflictList = `<details><summary>Click to open a list of ${conflictFiles.length} files</summary>\n\n${conflictList}\n</details>`;
8383
}
8484

85+
const readmeTip = conflictFiles.map(f => f.toLowerCase()).includes('readme.md') ? '\nPlease ignore changes in Readme.md (git checkout --ours Readme.md && git commit -m ignore Readme.md).\n' : '';
86+
8587
if (conflictList) {
8688
conflictList = `
8789
The following files have conflicts and may need new translations:
@@ -97,21 +99,23 @@ Please fix the conflicts by pushing new commits to this pull request, either by
9799
let tips = '';
98100
if (conflictList) {
99101
tips = `
100-
We recommend to merge conflicting changes manually and close this PR.
102+
We recommend to close this PR and merge conflicting changes manually.
101103
102104
The steps are:
103-
1. Setup upstream (if haven't yet)
105+
1. Add remote upstream that links to the English version (only needs to be done once)
104106
- \`git add remote upstream https://github.com/javascript-tutorial/en.javascript.info\`
105-
2. Commit all current work and \`git checkout master\`
107+
2. Commit all current work locally and \`git checkout master\`
106108
3. Pull the recent changes from the English version:
107109
- \`git pull upstream master\`
108-
4. Deal with the conflicts. If a conflict touches a few lines, then just fix them. Otherwise, if there are many changes, you can see them like this:
109-
- Checkout your version, \`git checkout --ours README.md\`
110-
- See what changed in the original file:
111-
- \`git diff --word-diff master...upstream/master README.md\` (please note: three dots in the command)
112-
- Re-translate or otherwise sync the translated version and commit it:
113-
- \`git commit -m synced README.md\`
114-
5. When conflicts resolved, \`git push origin master\`
110+
4. Deal with the conflicts. If a conflict touches a few lines, then just fix them. Otherwise, following commands can help:
111+
- Checkout translated version of a file/folder at the given path:
112+
- \`git checkout --ours <path>\`
113+
- Checkout upstream version of a file/folder at the given path:
114+
- \`git checkout --theirs <path>\`
115+
- See what changed in the upstream file since branches diverged:
116+
- \`git diff --word-diff master...upstream/master <path>\` (please note: three dots in the command)
117+
5. When conflicts resolved, commit them and \`git push origin master\`
118+
${readmeTip}
115119
`;
116120
}
117121

@@ -128,7 +132,7 @@ ${tips}
128132

129133

130134
let existingPrs = await octokitBot.search.issuesAndPullRequests({
131-
q: `type:pr Sync with upstream in:title is:open author:${config.botUser} repo:${config.org} /${langInfo.code}.${config.repoSuffix}`
135+
q: `type:pr Sync with upstream in:title is:open author:${config.botUser} repo:${config.org}/${langInfo.code}.${config.repoSuffix}`
132136
});
133137

134138
for(let existingPr of existingPrs.data.items) {

0 commit comments

Comments
 (0)