[MERGE][BUG #233817] Missing shows merged revisions with --include-merges

John Arbash Meinel john at arbash-meinel.com
Fri Sep 12 16:59:28 BST 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Vincent Ladeuil wrote:
...

>     john> I really don't like sometimes passing in 2 values and sometimes passing
>     john> in 3. Is there something we can do better here?
> 
> Yes. Two possible solutions:
> 
> 1) Always pass 3 values.
> 
> 2) Rework the whole thing to use LogRevision objects (since this
>    is where we take care of the problem *today*).
> 
> I did try (1) put it required updating tests and breaking
> backward compatibility. As I intend to do (2), I punted.
> 
>     john> ...
>     john> -        mainline.append((cur_revno, cur))
>     john> +        mainline.append((str(cur_revno), cur))
> 
>     john> ^- Since you are changing the signature, what about setting
>     john> "merge_depth=0" here for all mainline revisions. So something like:
> 
> This was a drive-by fix, doing (2) will get rid of it.
> 
>     john> mainline.append((str(cur_revno), cur, 0))
> 
>     john> ...
> 
>     john> +    def test_include_merges(self):
>     john> +        tree = self.make_branch_and_tree('tree')
>     john> +        rev1 = tree.commit('one', rev_id='rev1')
> 
>     john> ^- It would be nice to use the "BranchBuilder" api for this. Just as a
>     john> way to encourage new tests to be written without hitting disk unless
>     john> they are testing that portion of code.
> 
> Hmm, what I need here is the ability to create a branch from
> another existing one and then merge. This is not (yet?) provided
> by branch_builder and adding that is outside the scope of a tweak
> I think. I filed https://bugs.edge.launchpad.net/bzr/+bug/269319.

tree = self.make_branch_and_tree('tree')
builder = self.make_branch_builder('path')
builder.start_series()
builder.build_snapshot('A-id', [], [])
builder.build_snapshot('B-id', ['A-id'], [])
tree.pull(builder.get_branch(), 'B-id')

builder.build_snapshot('C-id', ['A-id'], [])
builder.finish_series()

built_branch = builder.get_branch()
tree.merge_from_branch(built_branch, 'C-id')

I believe all of that should work.

However, you *don't* actually need to do a "merge" you just need a graph
that includes a merge. So instead:

builder.start_series()
builder.build_snapshot('A-id', [], [])
builder.build_snapshot('B-id', ['A-id'], [])
builder.build_snapshot('C-id', ['A-id'], [])
builder.build_snapshot('D-id', ['B-id', 'C-id'], [])
builder.finish_series()

Now you have the graph you need, you just need a branch which points at
the right revisions. Probably easiest to do with

built = builder.get_branch()
built.sprout('target', rev_id)

John
=:->

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkjKkeAACgkQJdeBCYSNAAPU7gCgtS7ZcRajM89i+Q+IZgnluUtj
4LcAn3wJ5juwuPKGjaww61WGpiJ84AO2
=Prre
-----END PGP SIGNATURE-----



More information about the bazaar mailing list