bzr - create tgz file containing full repository - backup

I'm trying to backup my shared bzr repository. I have looked at bzr export hotcopy.tgz but it seems only to take a snapshot of the latest revision.
Is there a command for doing backups, or do I have to
full checkout into a tmp dir
compress the tmp dir
remove the tmp dir
Or is there a better way to backup a bzr repository?

You could try something like this:
mkdir /tmp/emptyrepos && bzr init /tmp/emptyrepos && bzr send -r 1..last:1 -o - /tmp/emptyrepos | gzip > mybackup.bzr.gz
That will create a bazaar native format merge-directive which you could apply to an empty repository to re-create all state.
Alternatively, it's likely safe to just tar up the current checkout. The on-disk format should be designed to safely deal with partial updates you may grab with tar.

Related

See files affected by previous commits in bzr

When using bazaar you can easily see uncommited changes with the bzr diff command. You can also see changes since a specific revision, or use bzr status to see the filenames only.
bzr diff -c 2169
bzr status -c 2169
Instead of looking for a specific commit number, using bzr log is there a simple way to look at all changes in a number of commits, the previous 2 commits for example?
You can view log of the previous 2 commits like this:
bzr log -l2
You can view all the logs from a specific revision until the end with:
bzr log -r2169..
You can of course specify an end range as well.
You might also find useful some interesting revision specifiers for example last:N. You can view the diff or status of the last 2 revisions with:
bzr diff -rlast:3
bzr status -rlast:3
You can read more about revision specifiers in bzr help revisionspec.
Let me know if you were looking for something else.
You can do this using verbose. With --verbose (-v), bzr log will print all affected paths.
To get the files affected only in last commit, use
bzr log --verbose -l1
To get the files affected is level of commits, use
bzr log --verbose -l<level-of-commit>
To get the files affected in specific commit
bzr log --verbose -r<rev-of-commit>
you can use either flag --verbose or --v

How do I clone a git repo from a local svn repo

I want to learn to use git-svn. I have an svn local repository on my disk that I've checked out a while ago using something like this:
svn co http://myserver.com/mysvnrepo/trunk/ /mysvnrepo/
ls -a /mysvnrepo/
. .. .svn foo bar
This /mysvnrepo/ is HUGE, so I want to avoid re-downloading or copying the files at all costs.
I'm wondering if there's a way to git clone this local repo without downloading / copying anything (because it's already there).
I have this which seems to be what I'm looking for, but when I do that it doesn't quite give me what I expect.
cd /mysvnrepo/
git svn clone file://mysvnrepo/
ls /mysvnrepo/
. .. .git .svn foo bar
git status
# On branch master
#
# Initial commit
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# .svn/
# foo/
# bar/
I would expect git to detect foo and bar as "versioned and up-to-date".
According to the docs it seems that I need to use git svn init because git svn clone runs a fetch, which I certainly don't want. So I tried
git svn init --trunk=file:///mysvnrepo/
...but no luck.
I'm completely new to git, so my confusion is off-the-charts... am I doing something utterly wrong?
Thanks in advance
You cannot take a subversion snapshot and convert it into a git repository.
It sounds like you are trying to avoid a lengthy initialization of the git repository from svn: which ordinarily will try to ready your entire history. This can be done in another way, by limiting the fetch to recent history depending on how much history is relevant to you:
git svn clone -s -r 12334:HEAD https://svn.host.org/repo
Where 12334 is the earliest svn revision you are interested in and assuming that the repo is laid out in a standard svn way with branches and tags.

Forcedly update workspace in Accurev

Is there any command to update my workspace forcedly in Accurev, directly replace the local files with the backed files, and don't care about the conflict files, modified files and so on?
I really miss the cvs command cvs update -C -d
According to question, I have similar issues. Usually I just use following commands:
accurev update -9
accurev pop -O -R .
accurev update
No, you will need to run a few operations. You can create a script to force update your workspace.
Basically, you will generate a list of all the modified, kept, overlap, member files, then purge those files, then update your workspace.
Check out the stat section in the CLI manual.
What You can do is delete all the local files from the file system and then do a:
accurev pop -R <path to local workspace directory>
I had similar issue; First take a back up of existing workspace, then Delete all the files in the local work-space folder. Click update button on Accurev. All files will be re-loaded on the workspace.
If you just want to undo all changes you have done in the workspace:
accurev stat -R -m -fl . | xargs -n 1 accurev purge
You can use similar command with rm / accurev pop to force refetch from backend. You can also vary the flags, -m for modified, -k for kept, -a for all.

How to undo bzr add

Sometimes I type bzr add and don't notice that I am not in the root of the branch but an ignored sub-folder. This then adds all files in that folders - often it is a build folder, with lots of files. Hence the question: how to undo a bzr add.
There is built-in way without need of xargs: bzr remove --new --keep
This answer is shamelessly stolen from here to make it more accessible (to me as well).
This will undo an erroneous bzr add:
bzr added -0 | xargs -0 bzr rm --keep

Can I take a bazaar branch and make it my main shared repository?

I have a bazaar repository on a shared server. I'd like to clean up the repo and set it up from scratch but maintain my history. I don't know how the repository was created initially (is there a way to find out?).
Can I take a branch and make that into my main shared repo?
Is this a viable process:
bzr init-repo --no-trees /home/bzr/myrepository
cd /home/bzr/myrepository
bzr init stable
cp /home/oldbzr/branch_taken_from_current_repo/* ./stable/
cp /home/oldbzr/branch_taken_from_current_repo/.bzr ./stable/
Thanks
A "branch" and a "repo" in Bazaar are totally separate concepts. You don't convert a branch into a repo. What you usually think of as a repo (in SVN or Git, for example) is actually a branch in Bazaar. What you want to do is create a new repo, then copy the old branch into the new repo.
You almost have it right, but you don't want to use "cp", you want to use "bzr branch". Note: You can usually use "cp" to copy branches except when you want Bazaar to move a branch into, out of, or across a repository -- then you need "bzr branch" to intelligently repack the history. So here is what you want to do:
bzr init-repo --no-trees /home/bzr/myrepository
cd /home/bzr/myrepository
bzr branch /home/oldbzr/branch_taken_from_current_repo stable
Note that I am not doing "bzr init" -- I don't want to create a new branch, just copy the old one. And I am not manually copying the old branch or its .bzr directory. If you copy the old branch's .bzr, it will not end up using the new repository. By doing a "bzr branch" it will go "oh hey, I am moving into a repository. Therefore, I will put all of my commit data into the shared repository, and just put a lightweight branch in 'stable'."
You can use just plain branch into your shared repo as mgiuca suggested, but you also can convert your standalone branch to use shared repository. For that your steps should be extended with bzr reconfigure call:
bzr init-repo --no-trees /home/bzr/myrepository
cd /home/bzr/myrepository
bzr init stable
cp /home/oldbzr/branch_taken_from_current_repo/* ./stable/
cp /home/oldbzr/branch_taken_from_current_repo/.bzr ./stable/
cd stable
bzr reconfigure --use-shared
So, if we omit cp then you can create a shared repository "around" your branch:
cd /path/to/my/branch
bzr info # you should see you branch is standalone,
# i.e. not using shared repo
bzr init-repo ../ # create shared repo in parent directory
bzr reconfigure --use-shared # convert standalone branch to repository branch
bzr info # now you should see your branch is using shared repo