mirror of
https://github.com/facebook/sapling.git
synced 2024-10-11 17:27:53 +03:00
f7231f2104
Instead of opening the target bzr checkout as a single branch, we try to open it as a repository. This has the following effects: - All branches are now converted - bzr branch names are preserved. Previously, the selected branch was always converted as 'default'. Branches without a name or 'trunk' are mapped to 'default branch. - Lightweight checkouts are no longer supported. Maybe they can be, I did not try to fix that at all. Implementation notes: - This was a quick fix, I have no knowledge of bzr API besides browsing 2.0.3 sources. - The fix was only tested on OSX against bzr 2.4.2. - Tags discovery does not handle collisions. I have no idea how tags work in bzr so maybe such collisions are not possible.
37 lines
939 B
Raku
37 lines
939 B
Raku
|
|
$ . "$TESTDIR/bzr-definitions"
|
|
$ cat > ghostcreator.py <<EOF
|
|
> import sys
|
|
> from bzrlib import workingtree
|
|
> wt = workingtree.WorkingTree.open('.')
|
|
>
|
|
> message, ghostrev = sys.argv[1:]
|
|
> wt.set_parent_ids(wt.get_parent_ids() + [ghostrev])
|
|
> wt.commit(message)
|
|
> EOF
|
|
|
|
ghost revisions
|
|
|
|
$ mkdir test-ghost-revisions
|
|
$ cd test-ghost-revisions
|
|
$ bzr init -q source
|
|
$ cd source
|
|
$ echo content > somefile
|
|
$ bzr add -q somefile
|
|
$ bzr commit -q -m 'Initial layout setup'
|
|
$ echo morecontent >> somefile
|
|
$ python ../../ghostcreator.py 'Commit with ghost revision' ghostrev
|
|
$ cd ..
|
|
$ hg convert source source-hg
|
|
initializing destination source-hg repository
|
|
scanning source...
|
|
sorting...
|
|
converting...
|
|
1 Initial layout setup
|
|
0 Commit with ghost revision
|
|
$ glog -R source-hg
|
|
o 1@source "Commit with ghost revision" files: somefile
|
|
|
|
|
o 0@source "Initial layout setup" files: somefile
|
|
|