according to the documentation I have questions
http://doc.bazaar.canonical.com/beta/en/user-reference/shelve-help.html
I can shelve by going bzr shelve
Can I name that shelve set as I see it gets an ID? eg bzr shelve "this is my first attempt"
how do I view all shelve sets?
How do I view specific changes to a specific shelve set
Are shelve sets relative to the repository that I am in?
First, let's create a shared repository and grab a sample branch to play with:
$ bzr init-repo /tmp/shared-repo
Shared repository with trees (format: 2a)
Location:
shared repository: /tmp/shared-repo
$ cd /tmp/shared-repo
$ bzr branch lp:~bzrbook/bzrbook-examples/shelving
Branched 6 revisions.
$ cd shelving
Your questions:
Can I name that shelve set as I see it gets an ID? eg bzr shelve "this is my first attempt"
Yes, using the -m flag, for example:
$ date >> menu.txt
$ bzr shelve -m 'menu change' --all
Selected changes:
M menu.txt
Changes shelved with id "1".
how do I view all shelve sets?
Using the --list flag, for example:
$ bzr shelve --list
1: menu change
Now you can see that giving a name to the shelf worked. If we hadn't given a name:
$ bzr rm guests.txt
deleted guests.txt
$ bzr shelve --all
Selected changes:
+N guests.txt
Changes shelved with id "2".
$ bzr shelve --list
2: <no message>
1: menu change
Btw, when you have shelves, the bzr status command tells you about them, and how to list:
$ bzr st
2 shelves exist. See "bzr shelve --list" for details.
How do I view specific changes to a specific shelve set
Using bzr unshelve --preview, for example:
$ bzr unshelve --preview 1
Using changes with id "1".
Message: menu change
M menu.txt
=== modified file 'menu.txt'
--- a/menu.txt 2014-04-11 05:34:17 +0000
+++ b/menu.txt 2014-04-11 05:37:55 +0000
## -16,3 +16,4 ##
Mixed burrito
Onion soup
Tacoz
+Fri Apr 11 07:34:13 CEST 2014
Are shelve sets relative to the repository that I am in?
Shelve sets are saved in your working tree. They are not part of the repository, in other words they are not version controlled. If you delete the working directory of the branch where you created your shelves, they will be lost. This is mentioned in the first paragraph of the Description in bzr shelve -h and the link you included.
Related
I'm trying to migrate an 11GB SVN repo with over than 24k revisions inside to a single GIT repository.
I did a single file dump of the SVN using svnrdump command and load it into my local SVN server, placed on my MacBook machine.
I downloaded the svn2git from the https://github.com/svn-all-fast-export/svn2git repository.
Due to differences in the way how SVN and GIT handle tags, I used a merged-branches-tags.rules from the svn2git sample directory, which look like this (I've removed comments):
create repository myproject
end repository
match /trunk/
repository myproject
branch master
end match
match /(branches|tags)/([^/]+)/
repository myproject
branch \2
end match
Then I used a docker image solution as described in the documentation (in my console it was a single line. I've did split it to clarify what I was doing):
docker run --rm -it \
-v /Users/me/work/SVN/dest:/workdir \
-v /Users/me/work/svnServer/repositories/my_svn_repo:/tmp/svn \
-v /Users/me/work/SVN/svn2git/samples:/tmp/conf \
svn2git /usr/local/svn2git/svn-all-fast-export \
--rules /tmp/conf/merged-branches-tags.rules \
--add-metadata --svn-branches --debug-rules --svn-ignore --empty-dirs \
/tmp/svn/
During the first try I got an error between revisions 12600 and 126001:
Exporting revision 12601 /tags/7.0M0p0000 was copied from /tags rev 12600
rev 12601 /tags/7.0M0p0000/ matched rule: "/tmp/conf/merged-branches-tags.rules:28 /(branches|tags)/([^/]+++++
)/" exporting.
.WARN: SVN reports a "copy from" # 12601 from /tags # 12600 but no matching rules found! Ignoring copy, treating as a modification
WARN: Transaction: "7.0M0p0000" is not a known branch in repository "myproject"
Going to create it automatically
add/change dir ( /tags/7.0M0p0000 -> "7.0M0p0000" "" )
+++++
WARN: Branch "7.0M0p0000" in repository "myproject" doesn't exist at revision 12601 -- did you resume from the wrong revision?
Failed to write to process: Process crashed for repository myproject
6223345 modifications from SVN /tags/7.0M0p0000/ to myproject/7.0M0p0000%
I've check it and in the rev 12601 there there is a new tag named as "7.0M0p0000", which I'm going to import as a branch and which wasn't in the repo in rev 12600.
Do you have any ideas what can I do to fix that and continue my migration?
Any help will be really appreciated.
After a further investigation, it turns out that the mentioned "7.0M0p0000" tag was created in the rev 12601 as a copy of all the tags from rev 12600.
I've found it in the dump file, created using this command:
svnrdump dump -r 12600:12601 --incremental http://xxx.xxx.xxx.xxx/svn/my_repo > my_repo.dump
There was an entry:
Revision-number: 12601
...
Node-path: tags/7.0M0p0000
Node-kind: dir
Node-action: add
Node-copyfrom-rev: 12600
Node-copyfrom-path: tags
It seems that KDE's svn2git is unable to deal with such cases (which was probably done by mistake).
The only solution I found was completely skip this tag by adding a match to my merged-branches-tags.rules file (order of match expressions is important):
match /tags/7.0M0p0000/
min revision 12600
max revision 12606
end match
...
match /(branches|tags)/([^/]+)/
repository myproject
branch \2
end match
What is the bzr equivalent of
cd ..
rm -fr widelands
git clone url/to/widelands.git
?
After searching for hours yesterday, how to get rid of local changes, I rage quit and did:
$ cd ..
$ rm -fr widelands
$ LANG=C bzr branch lp:widelands # LANG because of the well known not yet fixed bug
Branched 8986 revisions.
$ cd widelands
$ LANG=C bzr checkout
bzr: ERROR: A control directory already exists: "file:///[...]/widelands/".
???
$ LANG=C bzr remove-tree .
bzr: ERROR: Working tree "[...]/widelands/" has uncommitted changes (See bzr status).
????????????
$ bzr status
removed:
[list of thousands of files]
?????????????????????????????????
$ ls -lA
total 2
drwxr-xr-x 6 root root 2048 Feb 21 15:43 .bzr
According to this page https://wl.widelands.org/wiki/Building%20Widelands/, the steps to get the current development version of widelands is:
bzr branch lp:widelands
cd widelands
bzr checkout
[further steps to compile etc]
And that's basicly, what I tried above.
/edit: I now successfully tried LANG=C bzr revert --no-backup which didn't help me in the old repository before I rage quit, but the question still applies.
If what you're trying to do is remove the existing clone and create a new one, then the equivalent in bzr is:
$ cd ..
$ rm -fr widelands
$ bzr branch lp:widelands widelands
If you're trying to get rid of pending changes in the current control directory (i.e. git reset --hard), then bzr revert is what you're after.
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
Lets say I have 6 files that I'm working on and I only want to shelve 3 of the 6
Is this correct bzr shelve file1.txt file2.txt file5.txt -m "this is the thing"
How do I unshelve it later?
How do I delete the shelve if I do not need it?
Is this correct bzr shelve file1.txt file2.txt file5.txt -m "this is the thing"
Yes, that's correct. It will shelve the changes to the specified files and directories only. Furthermore:
If there are no changes in those, it will do nothing, just tell you No changes to shelve.
To skip the interactive questions for every change in those files, the --all flag is convenient, for example: bzr shelve file1.txt file2.txt file5.txt -m "this is the thing" --all
How do I unshelve it later?
Find the id of the shelf with bzr shelve --list. Then unshelve with bzr unshelve THE_ID. Btw, if you don't specify an id, then bzr unshelve will unshelve the most recent shelf.
How do I delete the shelve if I do not need it?
Using the --delete-only flag of bzr unshelve, for example:
bzr unshelve --delete-only THE_ID
bzr annotate gives revision numbers of the form a.b.c where a is the revision that was branched off; for our workflow it's more interesting to know in which revision this changed was merged back into the current repo. Can I get bzr to tell me this info?
You can use revision prefix mainline:, see bzr help revisionspec for details.
For example,
bzr revno -r 1.2.3
prints 1.2.3, but
bzr revno -r mainline:1.2.3
prints revision number for revision that merged 1.2.3.