woolfg/dokuwiki-plugin-gitbacked — pull request #12 by danny0838 (2013-10-28 04:55:02+00:00)
Title: Adjusted the configs and several functionality, add git importer and exporter

I made a rather big change for this plugin, here's a simple list of features:
* Configs change: add autoCommit, importMetaMsg, backupSuffix, gitPath, repoBase, dataBase, gitBranch; removed repoWorkDir
* Changed the default path of git repo and git working dir. All git manipulation are now under an independent directory that will never bother the real dokuwiki data.
* Fixed an issue that non-ASCII characters in the commit message are stripped.
* Add git importer and exporter. Supports history hiding and external commit.
* Replaced the lib/Git.php with a more customized one helper/git.php.

I've done most tests on my private server and it worked fine. Though further investigation and experiments would never be too much. :)

----
Below is a simple documentation about the importer and the exporter:
--

The importer imports all page and media revision into the git repo.

* Importing must be atomic. You should lock the wiki and the git repo from writing during the import process in case of data inconsistency.
* Only changes later than the top commit (of the specified branch) in the git repo are imported (unless you specified --full-history). You can reset your repo top to a previous time and re-import those dokuwiki changes later than that.
* Hidden pages, media, or meta (history entry) are supported. Move the item to the corresponding folder with a suffix (eg. attic/blah.123456789.txt.gz => attic.bak/blah.123456789.txt.gz) and they will be recognized during the importing process.
* Meta files other than *.changes, *.indexed, *.meta can be imported for backup (if --no-meta is not set), but their timestamp will be reset in the repo and be changed on export.
* Importing process is chronological, non-time-ordered history in *.changes will be resorted.
* Plugins recording data to extra non-meta files are not imported. You have to backup them separately.

The exporter exports history records in the git repo into the DokuWiki data.
* Exporting must be atomic. You should lock the wiki and the git repo from writing during the export process in case of data inconsistency.
* All wiki pages, media, and meta files (or limited to *.changes, *.indexed, and *.meta if --no-meta is specified) are removed before exporting, making a backup is recommanded in case something go wrong.
* After exporting, index (and meta data) rebuilding is required to get all things work right.
* Exporting process follows git revision order, non-time-ordered history is available, but they'll be messed up if you re-import them to git.
* External commiting (commits other than wiki import) and history rewriting are supported. You can import datain to git, rewrite git history, and them export it back to DokuWiki. For example, to rename a page, media, or a directory (namespace), simply git mv and then commit.
* To hide the content of a history entry, add "cmd: hide data" to the last line below ~~dokuwiki~~ in the commit message. Commits with this command will have attics saved to the corresponding backup folder (attic.bak or media_attic.bak).
* To hide an entire history entry, add "cmd: hide change" to the last line below ~~dokuwiki~~ in the commit message. Commits with this command will have entry in *.changes saved to the corresponding backup folder (meta.bak or media_meta.bak).
* Do not hide an entry that is exactly the current revision, or you'll get some problem after next import. Instead, delete the page in wiki and then hide the old histories.
* Only files in pages/, meta/, attics/, media/, media_meta/, and media_attic/ (may change by workDir) will be recognized and exported to DokuWiki. Other files are git-only.