Is it possible to read from Mercurial repository using PHP - php

After trying to get the mercurial repository explorer setup on my shared hosting with no luck, I have decided to try and write a module for our Intranet that will act as a repository explorer.
Is it possible for me to get changesets from a Mercurial repository without Mercurial installed on the machine?
Thanks for any help!
Metropolis

Definitely, but you probably don't need to do that. Mercurial has a static-http:// mode where it will let you clone and pull from repos that are merely sitting on an available web server. It's slower, but it works.
That said, folks have found that with enough work they can get all but the most restrictive shared hosting systems serving up hgwebdir.cgi.

Related

GitHub version control on FTP based website?

I am currently interacting with my sites via FTP, which can get quite annoying and impossible to manage at times.
Is it possible to use GitHub as a version control system for my PHP based websites which is on a different domain name?
If not, can anyone give me some advice on what tool I should look into using in order to set up version control.
You can create a git repository with all of your code for your website, and host it on Github. Then you can make changes, commit them to your local repository, and push them to Github. Afterwards, when you want to deploy your changes, do a git pull on your Github repository from the remote server.
Git is a distributed version control system. You have local repositories sitting in your local machine (your laptop, desktop, etc.) Github is a remote repository hosting service (sort of like Dropbox). When you want to sync the repo in your computer with the one hosted by Github, you do a pull/push. Then, you can sync the repository hosted by Github with the thrid repository on the server that hosts your website using a push/pull. No ftp is needed.
After a bit of research, found the solution to my question.
http://net.tutsplus.com/tutorials/tools-and-tips/how-to-use-git-with-ftp/

Using Git with shared hosting plan

So I started using Git together with this workflow to make a personal website (mostly for testing and to learn Git) and I am developing it locally on my laptop using Xampp.
But now I would like to make this website public and upload it to my webserver. Problem is, I use a shared hosting plan which means I only have FTP access to my website directory. Can't use SSH or install Git or anything..
I would like to deploy the website and any updates to that webserver, but I was wondering if that was possible with Git with only FTP access? And if not, what would be an advisable way to update my website? Manually drag an dropping files through Filezilla can get a bit tedious.
If you have no SSH access to the remote server and the hosting provider doesn't offer a git deploy feature, you won't be able to deploy directly using git.
However, it's always a good idea to track your source code regardless the remote options.
In your case, a good alternative to automate the release process would be to create a simple deploy script in your favorite programming language (Ruby, Python, Bash...) that loads the list of changed files from your git repository and performs an upload via FTP of these files.
A simple search for git-ftp reveals that there are already two projects that seems to do what I suggested:
ezyang/git-ftp
git-ftp/git-ftp
If you are in a shared hosting plan, its not a good idea to host your own git server as you'll have both space and bandwidth limitations. You can look out for other options such as github or if you want to have a private hosting, there is bitbucket
Maybe think about a different hosting set up?
On a VPS you have more freedom but you need to set up everything yourself.
On a cloud PaaS you will get great technology but pay a little more.
As mentioned above: A private repo hoster with ftp deployment option might also work.
For me, best productivity is most important. Compare costs of web hosting with costs for web development.
If git is installed on the server (e.g <?php $last_line = system('git --version', $retval); ?>), but you don't have SSH access, perhaps try php-git-bundle.
This question may be old but there is a shared web hosting which offers git deployment option and SSH access to git pull/push etc: githoster.com
Or there are some scripts you can search in google which will link your github account to your host with git hooks.

How to use Git in my workflow

I'm trying to learn how to use Git in my daily workflow but I'm slightly confused as to how to make it work for me. As a web developer, the way I work is that I have two VPS' - one as a production and the other as a development server. On the development server, I usually create a webdav that points to the source files (located in /home/public_html/dev.domain.co.uk/) and mount it as a local folder on my mac. This way, I can open (or create) the PHP files in my IDE, do what I need to, save the file and then refresh the test link in my browser.
Now, as I say, I would like to start using Git to keep track of all amends I, and my co-workers, make to projects. So my question is how would I do this - would I create a repository on my development server in the public_html folder? And when I clone the repository on the different machines I work on, would I mount the webdav and clone the repository in there? Ideally I want to set up an online repo that myself and co-workers can access.
Any help and/or advice would be much appreciated.
Thanks :)
I have a similar workflow. I was using my IDE to edit the files over SSH, effectively using the files directly on a development server. What I ended up doing was opening a console over SSH to my dev server, and running git there. I use Bitbucket as a remote, and push/pull from there, keeping all of my changes somewhat centralized. What I need to push to my production server, I pull from Bitbucket, and then flip a symlink so that all files appear updated instantaneously.
Git is a decentralized version control system, meaning that you do not need to have a "shared" repository. However, when collaborating, especially if you do not work closely with your coworkers, it might be attractive to have a central point with an "official" repository.
Now in your case, if you want to continue working in your WebDAV exported folder on your testing machine, it depends on if you share this folder with coworkers or not. If it's your private working space, create your git repository there and work with it however you like.
To setup a central, "official" repository you push you changes to, you have several choices depending on your infrastructure:
Use a 3rd party service like GitHub or BitBucket: This is simple to setup and use, but may require subscription fees if you want to keep your repository private.
Use your development server and setup a clone of your repository in a shared place, either via SSH or WebDAV. This might require more maintenance and you don't get the fancy WebUI of GitHub and the likes.
You might also want to have a look at this article about a branching model for development.
You could use a service like http://bitbucket.org.
it's free and it allows to create private and public repositories.
Once you commit changes, simply push it to the server (they tell you how to do it), then have your partner to clone that repository and pull from it whenever necessary.

SVN for PHP/MySQL

I'm currently developing a website using PHP/MySQL using Adobe Dreamweaver and has been asked to use a form of version control like SVN. I'm currently on a shared host Hostgator, how do I go about setting up SVN if it is possible. On their FAQ for SVN, they mention that they support the client not the server.
Are there alternatives to SVN? Can Github be used? I need my code to stay private not public...
EDIT: Is it advantageous to have the version control integrated into Dreamweaver?
Are there alternatives to SVN? Can Github be used?
Mercurial, git, CVS, bazar, ... just to mention some alternatives. Github can be used, of course, but this requires git to be used instead of SVN. In any case you should ask "the asker" (chef or customer I guess), if it is ok for him.
You have to install SVN server on the server machine and SVN client on your development machine. It free, so may be a good option.
Have a look here, tortoise SVN.
If you need your code private you can just use git.
write git init /location_of_project in command line and voila, local repo created.
read more info at http://git-scm.com/documentation
Github uses git for version control. You can use Source Forge for this purpose. Source Forge is a free project hosting site which uses SVN.
I love Cornerstone for OSX. Easy and intuitive for my needs which includes a local, private repository.

How to use Git or Subversion?

I code all by myself, and I have 1 website . but i dont ever use subversion or github. Question is:
How to develop on souce code of my website server and update it when develop complete.
In this case , should use github or subversion.
Truthly , i read and using github then try to create repository but anyone can watch mycode . I dont want that.
I want 1 guide easy for very begin about this.
You can use Git locally. So no need for Github. There is a video serie on www.tekpub.com about Git.
SVN and GIT are two completely different types of code repository patterns. If you using GIT you don't need a central server and can create a repository locally on your machine. I recommend you get familiar with this website just to get a basic overview of what a DVCS is and how it can affect the way you code.
HgInit
The good news is that you aren't familiar with any VCS (I assume) and that means you won't get mixed up when trying to learn GIT coming from SVN.
Assuming you already know the basics of how to commit/push/etc with git, which your answer suggests you do, the problem is that your repo is set to be public and not private. You can change this on the repo's admin page, assuming your github account has enough private repos left (The lowest account level that supports this is USD$7/month iirc). There are other git hosts which you can use for free that provide private repos.
As Roger said, you can use Git locally and do not need a server for that.
For SVN you need a central repository server, that usually does not correspond to your live webserver.
You will need a running Apache server and install SVN as an additional module for it. Once you have a subversion server running, you can then add repositories to it, normally one repository per project.
Usually you would have a local subversion installation on a development server in your local network or even (as you work alone) on your local machine, using a distinct host/port configuration for SVN, e.g. you could use localhost:80 for your development of the live website, and localhost:9999 for your SVN installation. There are several guides for installing SVN on Windows, Linux and MacOS found via google.
Both version control systems require some initial work to get it, but I personally prefer Git over SVN. Check out the Git guide on stackoverflow or the SVN book.
Personally, I find SVN easier to learn and install than GIT (but I guess that depends on person ;) and OS - I'm on windows unfortunately)
That's why I choose some free personal host for that. I tried BeanStalk and XP-Dev. The first one, is cleaner and much more user-friendly... and offer GIT or SVn ! But you got only 1 personal project available for free.
The second one is ugly but quite performant, 2 personal projects but only with SVN for free.

Categories