Skip to content

Backporting tutorial

stfx edited this page Aug 27, 2012 · 2 revisions

This tutorial was written by stfx for Mangos-One and Mangos-Zero developers to correctly backport commits from master.

1. Set up the directory

2. Backport an actual commit

  • Fetch from mangos-master every time something changes there: git fetch mangos
  • Use backport tool in git bash: .git/mangos-backport.sh _commit_hash_
  • Check and resolve conflicts (usually there is a conflict because of changed revision_nr.h)
  • Amend commit and change commit message if needed: git commit --amend

2.1. Backport a commit with sql changes

  • Fetch from mangos-master (like before)
  • Use backport tool (like before)
  • Check and resolve conflicts (like before)
  • Rename the sql updates in sql/updates directory by adding this commit's version number at the start of the filename like so: 11754_01_mangos_mangos_string.sql -> s1415_11754_01_mangos_mangos_string.sql
  • Remove the lines related to db_version change (in the sql update file usually the first one and the empty line after that)
  • Amend commit (like before)

3. Number the commit with git_id

  • Build git_id tool in release mode if you did not already (located in contrib\git_id)
  • Use git_id in git bash: contrib/git_id/Release/git_id.exe
    • This only works if you push every time you commit something but it is also possible to use git_id.exe -l for local mode but then you can not use git_id.exe -s

3.1. Number the commit with sql changes

  • Use contrib/git_id/Release/git_id.exe -s so that all db_version changes will be automatically written to mangos.sql and in the sql/updates/*.sql
    • You have to push every outstanding commit before that because git_id.exe -s does not work with git_id.exe -l

4. Push the commits

  • Push only to the mangos-one remote: git push origin master (depends how you named the mangos-one remote)