views:

55

answers:

1

Hi friends,

Here is a real version control system dummy! proper new starter!


The way I have worked so far:

I have a Drupal-6 web project www.blabla.com and making development under www.blabla.com/beta . I'm directly working on blabla.com/beta on server. nothing at my local, nothing at anywhere else. Only taking backup to local, time to time. I know horrible and not safe way :/


The new way I want to work from now on:

I decided to use Mercurial. I have one more developer to work on same project with me. I have a blabla.com Drupal-6 project on bluehost and making development blabla.com/beta. I found out http://bitbucket.org/ for mercurial hosting. I have created an account.

So now how do I set up things? I'm totally confused after reading tens of article :/

  • bitbucket is only for hosting revised files? so if I or my developer friend edit index.php, bitbucket will host only index.php?
  • from now on do I have to work at localhost and upload the changes to blueshost? no more editing directly at blabla.com/beta? or can I still work on bluehost maybe under blabla.com/beta2?
  • When I need to edit any file, do I first download update from bitbucket, I make my change at localhost, update bitbucket for edited files, and uploading to bluehost?

Sorry for silly questions, I really need a guidance...

Appreciate helps so much! thanks a lot!

+3  A: 

bitbucket is only for hosting revised files?

The main service of bitbucket is to host files under revision control, but there is also a way to store arbitrary files there.

so if I or my developer friend edit index.php, bitbucket will host only index.php?

I a typical project every file which belongs to the product is cheked into revision control, not only index.php. see this example

from now on do I have to work at localhost and upload the changes to blueshost? no more editing directly at blabla.com/beta? or can I still work on bluehost maybe under blabla.com/beta2?

Mercurial does not dictate a fix workflow. But I recommend that you have mercurial installed where you edit the files. For example then you can see direct which changes you did since the last commit, without to need to copy the files from your server to your local repository.

I absolutely recommend a workflow where somewhere in the repository is a script which generates the archive file which is transmitted to the server, containing the revision of the repository when the archive got created. This revision information should also be somewhere stored on the server (not necessarily in a public accessible area), since this information can get very handy when something went wrong.

When I need to edit any file, do I first download update from bitbucket, I make my change at localhost, update bitbucket for edited files, and uploading to bluehost?

There are several different approaches to get the data to the server:

  • export the local repo into an archive and transmit this onto the server (hg archive production.tar.bz2), this is the most secure variant, since it does not depend on any extra software on the server. Also depending on how big the archive is this approach can waste lots of bandwidth.
  • work on the server and copy changed files back, but I don't recommend this since is is very easy to miss something important
  • install mercurial on the server, work in a working copy there and hg export locally there into the production area
  • install mercurial on the server and hg fetch from bitbucket(or any other server-accessible repository)
  • install mercurial on the server and hg push from your local working copy to the server (and hg update on the server afterwards)

The last two points can expose the repository to the public. This exposition can be both good and bad, depending on what your repository contains, and if you want to share the content. When you want to share the content, or you can limit the access to www.blabla.com/beta/.hg, you can clone directly from your web server.

Also note that you should not check in any files with passwords or critical secrets, even when you access-limit the repository. It is much more save to check in template files (with a different name than in production), and copy-and-edit these files on the server.

Rudi
thanks for detailed reply! I have been reading your reply again and again to understand all details. I sorted out many things, thanks, tested bitbucket from my localhost repository,. works great. As a last thing, I need to find out a way to install mercurial to bluehost as I understand from your post since I will be making my development on bluehost (not at my localhost), right?
artmania
First check if there is already python installed. If it is so, you can download the hg source and try to install it with `python setup.py install --prefix=/path/to/your/home/directory/hg`. If this fails because there is no compiler installed, continue with `python setup.py --pure install --prefix=/path/to/your/home/directory/hg`, which install the pure-python variant (there are some c modules for optimization, --pure select to fall back to pure python code).
Rudi
@artmaniaAfterwards you need to put /path/to/your/home/directory/hg/bin to your PATH and /path/to/your/home/directory/hg/lib/site-packages to your PYTHONPATH. When your shell is bash you can add `export PATH=$PATH:/path/to/your/home/directory/hg/bin;` and `export PYTHONPATH=/path/to/your/home/directory/hg/lib/site-packages` to your `~/.bashrc` .(Thanks to the 600char comment limit I needed to split the awnser into two comments. **grml**)
Rudi