-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Github Gist / Repo integration #146
Comments
I've considered a Gist integration before, but never got round to implementing it. How would you see Git/GitHub integration working from a user's perspective? For example:
I've no experience of doing Git integration but am happy to investigate. Any relevant resources you can point me at would be helpful. On a related point I have considered building some kind of limited version control within CodeSnip - something like Delphi offers where changes are tracked and can be diffed and / or reverted. Just wondering how useful that might be. |
I'd defer to your vision, of course, since this is your baby. 😄 I could see an SCM integration (especially one that integrates with GitHub / some other remote host) potentially useful for multiple usecase, including a possible means to:
|
I'm a beginner in Pascal by the way, but pretty interested in and serious about learning it. I'm actually surprised that it's not more popular, especially in Windows since it compiles to native, lightweight and super fast binaries, not to mention that it's (from what I've read) an ideal language for new coders, originally created as a way to teach Programming. The point in this explanation is that I'd much prefer to contribute these features myself rather than simply suggest/request them, and I would were I able to. I love your application, so once I am able to, I look forward to contributing to it. |
Great thanks. I think I've got the gist (pun fully intended) of what you're looking for. I'll go off and research the GitHub API to see what may be possible and come back if and when I can work out what needs to be done. Once you're feeling up to speed in Pascal I'd really welcome contributions. The main downside is that I'm stuck using Delphi XE for CodeSnip (reasons here) and not a lot of people still use it. I'm glad you like CodeSnip. I've been developing it on and off since 2005. That does bring some problems though in that the code has become a bit of a mess over the years. It really needs a rewrite, but I've tried and failed to do that numerous times. Being a single-handed hobbyist coder with other interests means I don't spend a lot of time on it these days. |
After some poking around the net I've discovered a couple of projects that ease the access to the Git API. However many people suggest that it's easier, and more portable, to call git from the command line to perform desired actions. CodeSnip already has the facility to run external programs (currently the Delphi / FPC compiler) so calling git should be relatively easy (famous last words) |
You got me hooked! I've been doing a lot of thinking and poking around in long forgotten corners of the CodeSnip source code. The TL;DR version is in the summary at the end of this comment. How much sense it makes without the following I don't know! Here are a few initial thoughts on your suggestions:
If this is restricted to the current CodeSnip user database (i.e. your own snippets) then I think this is doable. With a few tweaks the user database could be converted to a Git repo. That would enable Git to be used to commit / restore changes etc and to push and pull to a remote repo. However, this would require the repo content to conform to the CodeSnip user database format, which essentially is an XML file containing meta data and a It strikes me that implementing Git inside CodeSnip could be done incrementally over different releases because whatever Git functionality isn't in CodeSnip can easily be achieved using Git from the command line.
Quite a bit harder!! The difficulty is nothing to do with adding Git support but is concerned with how CodeSnip stores snippets. It requires meta data: every snippet MUST have a unique ID, a display name and a description. A lot of code breaks if that requirement is dropped, so its non-negotiable. Let's split external repos from Gists because they're different. External reposThere's no way we can expect that other repos will conform to CodeSnip's requirements. Yep, we can get Git to pull them. But there's no current way of importing them into CodeSnip unless we can fudge the creation of the required ID and description. I can see ways round this though. However, there's a bigger problem. CodeSnip only knows about two data sources: the "main" database that can be downloaded from the DelphiDabbler Code Snippets Collection and the "user" database, which contains your own snippets. CodeSnip can currently export and import snippets from other CodeSnip users and the SWAG archive, but such imports are "lost" in the user database. The database doesn't track the source of the imported code, so it's just like it was typed in. For external snippet sources to work properly with CodeSnip so that changes can be pulled and pushed, the architecture of how CodeSnip reads / writes user data needs to change. I've thought of an approach which may work. It is to get CodeSnip to read and write multiple data sources and to track which source each snippet comes from. Updates can then be read/written to the relevant source. Such an approach would work whether or not the user wished to use Git. But its a precondition for your proposal. And, although it's harder than applying Git to the user database, I'm quite motivated to implement it. (By coincidence such a change would enable me to solve a further problem that's been bugging me for years, which is the need to keep the "main" database read-only to ensure synchronisation with the Code Snippets Collection). GistsAgain this is one I've considered doing before, but never have! I've not given quite so much though to this, but first thoughts are:
I think we'd get this for free if the above problems get solved! Summary
It's been hard to explain all this, but I hope it makes some kind of sense. I'd love to get your feedback. I'm trying to get a sense of where to start 1st: update the data sources or add Git to the user databases. |
@pa-0 Nearly got to a point where you can add other snippet directories. No progress yet on Git integration. |
Would you ever consider integrating git SCM (or a GitHub integration)?
The text was updated successfully, but these errors were encountered: