I am building the browser-based web development software at http://gnymb.us. Eventually we wi开发者_如何学Cll have limited offline support, such that you can edit your files offline by leveraging localStorage, HTML5 databases, or Google Gears.
I am currently building in source control support for Subversion, Mercurial, and Git. This works great while the user is online. As you may know, Mercurial and Git allow us to work offline. One difficulty to offline support for the editor is that, because this software is browser-based, the user will not be able to utilize offline SCM features.
Would it be theoretically possible to bundle Mercurial or Git in a browser extension and then modify it to utilize hash-based localStorage or HTML5 databases rather than a file system hierarchy--without rewriting everything? I know Mercurial uses Python, so I'd want to use Python in the browser extension. I'm open to other solutions as well.
You can build a plugin (or a native code based browser extension) for each browser, and link the VCS code into it. But you instantly get 3 Problems:
- You need to create a new plugin, which limits your potential users (not everyone is happy to install plugins)
- You need to create this plugin for each different browser, and for each supported plattform
- You have to take care of the plugin license, since mercurial and git are GPL, while SVN is APL.
You could reimplement the essential parts of git in the extension. Git's model is pretty simple and this has already been done in other languages, for instance Ruby (grit).
精彩评论