Skip to content

Commit b41eb4c

Browse files
Merge pull request #38 from r-devel/MichaelChirico-patch-1
Update conflict resolution advice based on latest experience
2 parents 2629bae + 1cf9b6a commit b41eb4c

File tree

1 file changed

+5
-50
lines changed

1 file changed

+5
-50
lines changed

web/Weblate-server.qmd

+5-50
Original file line numberDiff line numberDiff line change
@@ -303,62 +303,17 @@ Weblate will provide a suggestion on how to fix, but in short:
303303
git svn rebase
304304
```
305305

306-
1. Optionally, if not yet done, install [helpers](https://github.com/JulienPalard/po3way) to make it easier to deal with the git conflicts (inside Docker). Start Docker as root to install `po3way` system-wide:
307-
308-
```sh
309-
$ sudo docker exec -u root -ti weblate-docker_weblate_1 bash
310-
```
311-
312-
Then in the Docker container:
313-
314-
```sh
315-
# pip install --prefix /usr/local po3way
316-
# exit
317-
```
318-
319-
To set up `git` to always use `po3way`, first start the Docker container using the regular user:
320-
321-
```sh
322-
$ sudo docker exec -ti weblate-docker_weblate_1 bash
323-
```
324-
325-
And edit `.git/config` at `app/data/vcs/r-project/base-r-gui` to add the below content:
326-
327-
```sh
328-
[merge "po3way"]
329-
name = po file merge driver
330-
driver = po3way --git-merge-driver -- %A %O %B
331-
```
332-
333-
Also edit `.gitattributes` to include:
306+
1. (repeat until rebase completes) Resolve any conflicts that come up, usually using the script [`deconflict_add_continue.py`](https://github.com/daroczig/R-weblate-fork/blob/main/deconflict_add_continue.py) found at the repo root:
334307

335308
```sh
336-
*.po merge=po3way
337-
*.pot merge=po3way
309+
./deconflict_add_continue.py weblate
338310
```
339311

340-
1. Resolve the conflict via a text editor, then continue. Let's say `src/library/base/po/es.po` is affected:
312+
This finds the **one** file causing conflicts, selects the changes from Weblate (in order to preserve string edit history in the UI), removes the changes from SVN and the git conflict markers, then continues the rebase process. It also prints some helpful output, e.g. the number of conflicts resolved and the `git status` which tells about progress in the ongoing rebase.
341313

342-
```sh
343-
mcedit src/library/base/po/es.po
344-
git add src/library/base/po/es.po
345-
git commit -m "resolve conflict"
346-
git rebase --continue
347-
```
348-
349-
I usually do the `git` commands inside Docker (at `app/data/vcs/r-project/base-r-gui`), and the edits outside of Docker (at `/var/lib/docker/volumes/weblate-docker_weblate-data/_data/vcs/r-project/base-r-gui`) as it's more comfortable, but feel free to install anything that makes your life easier even within Docker (see e.g. the installation steps for `po3way` above on how to become root).
350-
351-
To see the current progress of conflict resolution, run something like:
352-
353-
```sh
354-
( RMD="$( git rev-parse --git-path 'rebase-merge/' )" && N=$( cat "${RMD}msgnum" ) && L=$( cat "${RMD}end" ) && echo "${N} / ${L}" ; )
355-
```
356-
357-
And make sure to use `rerere` (reuse recorded resolution) to speed up resolving the individual conflicts:
314+
For now, if there are more than one files affected by a given rebase step (e.g. more than one file marked `both modified:` in the `git status` output), these needed to be edited manually (with the text editor of your choice, e.g. `nano` or `mcedit`), then added (`git add`) before continuing (`git rebase --continue`). This should be rare as Weblate typically associates one file edit per commit. The `deconflict_add_continue.py` step could be extended to handle several files, but we've not yet done so. Note also the script [`show_conflicts.py`](https://github.com/daroczig/R-weblate-fork/blob/main/show_conflicts.py) which takes a file name as an argument and prints a side-by-side view of any git conflicts in the file.
358315

359-
```sh
360-
git config --global rerere.enabled true
361-
```
316+
1. Restore changes that may have been lost from SVN, e.g. newly updated source strings or source line numbers, by running `msgmerge` on all pot files using the script [`update_pkg_po.py`](https://github.com/daroczig/R-weblate-fork/blob/main/update_pkg_po.py).
362317

363318
## Administrators
364319

0 commit comments

Comments
 (0)