Skip to content

Merge! Conflict with origin master

jaumef edited this page Feb 8, 2017 · 1 revision

Merge! - Conflict with origin/master

When you want to add your changes to this repository's documentation, you may need to merge with origin/master if you have conflicts.

If the conflict is not from the po-files then using "git merge origin/master" should solve your problem.

Otherwise, the po-files merging is a more complex process...

To make it easier @jaumef wrote the merge.sh script.
So just run:

$ ./merge.sh

But you can always merge on your own way.

Steps to follow

  1. Clean your repository (commit all remaining files, delete unused ....)

  2. Save your po-file with the translations into a file.
    i.e.:

    $ cp messages.local.po locales/es_ES/LC_MESSAGES/messages.po
  3. Get the po-file from origin/master (there are serveral ways to do this)
    i.e.:

    git checkout origin/master -- locales/es_ES/LC_MESSAGES/messages.po
    cp messages.remote.po locales/es_ES/LC_MESSAGES/messages.po
    # checkout origin/master adds the file to commit, which may be undone
    git reset HEAD locales/es_ES/LC_MESSAGES/messages.po
    git checkout locales/es_ES/LC_MESSAGES/messages.po
  4. Merge the pofiles. Using msgcat --use-first is usefull for most cases.
    Just run:

    msgcat --use-first messages.local.po messages.remote.po -o messages.merged.po
    # And replace the unmerged messages.po file
    mv messages.merged.po locales/es_ES/LC_MESSAGES/messages.po
  5. Clean the repository from tmp files and watch out for possible troubles.
    Then just git commit your changes and we're DONE.

Possible Troubles

  • Another branch deleted a string from the same pofile. After the merge is done, you won't:

    • Pass the test because the new pot-file will have less strings than the new po-file

    • OR the new po-file won't have all the strings translated.

      There's a little bug showing sometimes on this case, I couldn't restrain better it's appearence.
      To solve this:

    1. Remove the old locales/messages.pot file
    2. Build your documentation using mkdocs build -f mkdocs_es.yml --clean This command will create a new pot file with the
    3. Update the locales/es_ES/LC_MESSAGES/messages.po file using:
      msgmerge -U locales/messages.pot locales/es_ES/LC_MESSAGES/messages.po
    4. Run the test python check_strings.py and translate the strings if needed.