test

progging - To wander about and beg; to seek food or other supplies by low arts; to seek for advantage by mean shift or tricks.
progging - Programmer slang for writing computer code.
Viser innlegg med etiketten Bazaar. Vis alle innlegg
Viser innlegg med etiketten Bazaar. Vis alle innlegg

onsdag 22. februar 2012

Quick list for adding a new repository

Normally, we work in a centralized workflow and here are a few steps for setting up a new repository for a project.

1. Create repository on the server (v:\bzr):

bzr init-repo --no-trees v:\bzr\MyNewProject

bzr init v:\bzr\MyNewProject
  Created a repository tree (format: 2a)
  Using shared repository: V:/bzr/MyNewProject/


2. Checkout repository on each development machine:

c:\Projects>bzr init-repo --trees MyNewProject
Shared repository with trees (format: 2a)
Location:
  shared repository: MyNewProject



c:\Projects\MyNewProject>bzr checkout v:\bzr\ MyNewProject 8.9x


3. On the machine that has any existing code to add:
- Copy or create a .bzrignore file first!

c:\Projects\MyNewProject>bzr add (--dry-run)
c:\Projects\MyNewProject>bzr commit -m "initial import"

Moving a Bazaar repository

I've been using Bazaar in a centralized workflow, with a repository on a server. I wanted to move the repository to a different server that will be backed up. This was as simple as copy the complete bzr repository folder from server A to server B, and then do a bzr switch on each of the locations where I had been working on the project.

C:\Projects\ABC>bzr switch v:\bzr\ABC
Tree is up to date at revision 145.
Switched to branch: V:/bzr/ABC/


Remember to commit any changes you have first!

søndag 11. september 2011

Bazaar Bug

At one point Bazaar started acting up. The command line tool worked just fine, but I like to use TortoiseBzr when commiting to be able to easily check all the changes I've done before the commit. But both TortoiseBzr and Bazaar Explorer only returned an error when starting up.

So I filed a bug at launchpad, and within less than an hour after I had registers at launchpad (unfortunately, you have to register to be able to submit a bug report), I got an email with a solution. It was simply a config file (qbzr.conf) that was corrupt and all that was needed was to delete it. Great support work though!!!


By the way, the problem occurred after a windows blue screen...

mandag 29. august 2011

Bazaar Bug

I encountered this bug in my Bazaar repository.
I'm not sure how the master branch got out of date with the bound branch, but what had happened was that some files got accidentally added at the root, then when I did a bzr rm things got screwed up. The error I got was:
bzr: ERROR: Bound branch BzrBranch7(file:///C:/Documents%20and%20Settings/xx/) is out of date with master branch BzrBranch7(file:///U:/Utvikling%20Backup/srv/bzr/xx/).
To commit to master branch, run update and then commit.
You can also pass --local to commit to continue working disconnected.

Doing a bzr update just said that
Tree is up to date at revision 1 of branch U:/Utvikling Backup/srv/bzr/xx

When I did a bzr log at the master branch it said it was up to date at revision 0.
So I knew the master branch was out of date and did a bzr push U:/Utvikling Backup/srv/bzr/xx and after that everything was fine :)

søndag 28. august 2011

Bazaar - Joining

One of the challenges when putting your project under version control is how to organize all the different projects/solutions/DLLs/what-have-your...Should everything be under one project in your VCS or should them be separate. It could be all independent programs that are released independently but still are part of the same 'package' and might even share some code.

When I first set up my projects I put them each under separate trees. I first learned this was a mistake when I wanted to move a file from one project to another. "Can't move files between different branches" - says Bazzar.

But luckily it is pretty easy to 'join' two branches into one!

My project was set up like this:

\MainDir
\MainDir\ProjectDisplay
\MainDir\ProjectLog
\MainDir\CommonSource

Because of a bug, the join command does not work if the main/root branch has no commits in it already. So if you don't have any files commited in the main directory yet, it's time to do so. First, the different project/branches was created like this:

Create common repository at main dir and make it a bazaar branch too
C:\MainDir>bzr init-repo .
C:\MainDir>bzr init .
Create a separate branch in each project directory
C:\MainDir\Dir1>bzr init .
...add and commit files in sub dir 1
C:\MainDir\Dir2>bzr init .
...add and commit files in sub dir 2
Then do a join and commit
C:\MainDir\bzr join Dir1
C:\MainDir\bzr commmit -m "joining Dir1"
The commands with output for joining two directories are shown here:


After the complete join the log history looks like this:

By default, only the main (important) revisions are shown.

Bazaar nicely handles revision history in different branches.
The solution was first found here: https://answers.launchpad.net/bzr/+question/71563

torsdag 11. august 2011

Bazaar: copy file from one branch to another unrelated branch


Bazaar was set up so that each program was it's own branch

\DisplayProgram
\LogProgram
\CommonSource

So moving a file (Statistics.pas) from the display program to the common source was not possible since you can't bzr move from one branch to another. So the solution was to use the export/import merge solution.

..DisplayProgram>bzr fast-export . > full-branch.fi
..DisplayProgram>bzr fast-import-filter -i Statistics.pas full-branch.fi > Statistics.fi
..DisplayProgram>mkdir ..\Temp
..DisplayProgram>bzr init ..\Temp
..DisplayProgram>bzr fast-import Statistics.fi ..\Temp
..DisplayProgram>cd ..\CommonSource
..CommonSource>bzr merge ..\Temp -r0..-1
..CommonSource>bzr commit -m "Moved file from SourceDisplay using export/import then merge"
From:
http://stackoverflow.com/questions/3547493/bzr-copy-file-from-one-branch-to-another-unrelated-branch

As a final step, after you are done moving the file, you probably want to remove the file from it's original branch.
..DisplayProgram>bzr rm Statistics.pas
..DisplayProgram>bzr commit -m "Final step of moving file to common place"

Note:
When I tried to do this a second time on another file (same directories involved), I got a problem. The old file, Statistics.pas, appeared in the temporary directory. I created a brand spanking new directory, even with a different name, but the old file seem to appear magically....
Then I read the bzr fast-import help...
Restarting an import:
 At checkpoints and on completion, the commit-id -> revision-id
 map is saved to a file called 'fastimport-id-map' in the control
 directory for the repository (e.g. .bzr/repository). If the import
 is interrupted or unexpectedly crashes, it can be started again
 and this file will be used to skip over already loaded revisions.
 As long as subsequent exports from the original source begin
 with exactly the same revisions, you can use this feature to
 maintain a mirror of a repository managed by a foreign tool.
 If and when Bazaar is used to manage the repository, this file
 can be safely deleted.
So, remove the fastimport-id-map file in the .bzr/repository directory when you are done with the import! Then you are ready to do another one :)

fredag 5. august 2011

Version Control System - Bazaar

As I find it extremely useful to work with a version control and the current workplace didn't use one, I started to look for a suitable one. I wanted to start using Git as that seems to be the new cool one, but during my research someone recommended Bazaar, saying Git could be too complicated. And being that this was something I just wanted to test out personally, I went ahead and tried it.

It was extremely easy to get started with Bazaar. Everything went smoothly, the documentation is superb! I have experience with SVN and CVS so most is very common although some concepts are very different.

The coolest thing is that it is so flexible. It's suitable from one user to large teams, you can work only locally or with a remote 'server'. It doesn't have to be server per say, just another machine that might be backed up. Even if you work towards a server you can still commit locally for a period (without access to the server). Later, you can commit to the server and all history will still be available. And there is no install on the server (every user just installs on their machine) so there is no network setup!