Resolving diverged branches in Subversion repository

Ben Finney ben at benfinney.id.au
Fri May 16 09:25:19 BST 2008


Howdy all,

I'm working as part of a team using a Subversion repository. I'm using
Bazaar as my client to work with this repository.

It will be useful for readers to examine this repository, to see the
effects being discussed here. The URL is
<URL:svn://svn.debian.org/svn/reportbug/trunk/>.

Relevant software versions:

=====
$ bzr version
Bazaar (bzr) 1.3.1
  Python interpreter: /usr/bin/python 2.5.2.final.0
  Python standard library: /usr/lib/python2.5
  bzrlib: /usr/lib/python2.5/site-packages/bzrlib
  Bazaar configuration: /home/bignose/.bazaar
  Bazaar log file: /home/bignose/.bzr.log

$ aptitude show bzr-svn | grep 'Version:'
Version: 0.4.9-1
=====


A few times now I've overlapped my changes with someone else in the
repository, resulting in a "These branches have diverged" message when
I try to 'bzr push' my changes to the Subversion branch. So, I then
merge the Subversion branch into mine, commit the result, and push
again; the push then succeeds.

Typical sequence (Sandro is another member on the team, using the
Subversion 'svn' client):

* Sandro: 'svn update'
* Ben: 'bzr pull'
* Sandro: hack hack hack
* Ben: hack hack hack
* Sandro: 'svn commit' (to the central repository)
 -> success
* Ben: 'bzr commit' (to my local branch)
 -> success
* Ben: 'bzr push' (to the central repository)
 -> fail, "Branches have diverged, please merge."
* Ben: 'bzr merge' (Sandro's changes with my changes)
 -> success
* Ben: 'bzr commit' (the result of the merge)
 -> success
* Ben: 'bzr push' (to the central repository)
 -> success
* Sandro: 'svn update'
 -> success (gets Ben's new commits)

The result is a consistent tree, but Sandro is complaining that the
revision log contains a revision that is essentially a duplicate of
changes already made in the tree. Sandro shows me the result of his
inspecting my changes:

> Author: bignose-guest
> Date: Fri May 16 00:02:46 2008
> New Revision: 495
>
> URL: http://svn.debian.org/wsvn/reportbug/?sc=1&rev=495
> Log:
> Merge from svn.debian.org trunk.
>
> Modified:
>    trunk/   (props changed)
>    trunk/debian/changelog
>    trunk/debianbts.py
>    trunk/reportbug
>
> Propchange: trunk/
> ------------------------------------------------------------------------------
> --- bzr:ancestry:v3-trunk0 (original)
> +++ bzr:ancestry:v3-trunk0 Fri May 16 00:02:46 2008
> @@ -1,2 +1,3 @@
>  svn-v3-trunk0:692dde74-6b68-4300-bcb1-27de2ae967a4:trunk:465
>  ben at benfinney.id.au-20080513092239-x05am8p276tb2kg1
> +svn-v3-trunk0:692dde74-6b68-4300-bcb1-27de2ae967a4:trunk:493
>
> Propchange: trunk/
> ------------------------------------------------------------------------------
> --- bzr:revision-id:v3-trunk0 (original)
> +++ bzr:revision-id:v3-trunk0 Fri May 16 00:02:46 2008
> @@ -25,3 +25,4 @@
>  35 ben at benfinney.id.au-20080514133553-5widku0hx6nsff9d
>  36 ben at benfinney.id.au-20080514134337-n4oqeqmxoziqien1
>  37 ben at benfinney.id.au-20080515235707-onlz56zkx3x12i5r
> +38 ben at benfinney.id.au-20080516000116-t4vrd4o9i80bd0z5
>
> Propchange: trunk/
> ------------------------------------------------------------------------------
> --- bzr:revision-info (original)
> +++ bzr:revision-info Fri May 16 00:02:46 2008
> @@ -1,4 +1,4 @@
> -timestamp: 2008-05-16 09:57:07.506999969 +1000
> +timestamp: 2008-05-16 10:01:16.520999908 +1000
>  committer: Ben Finney <ben at benfinney.id.au>
>  properties:
>        branch-nick: reportbug.trunk
>
> Propchange: trunk/
> ------------------------------------------------------------------------------
> --- svk:merge (original)
> +++ svk:merge Fri May 16 00:02:46 2008
> @@ -1,1 +1,2 @@
>  692dde74-6b68-4300-bcb1-27de2ae967a4:/trunk:465
> +692dde74-6b68-4300-bcb1-27de2ae967a4:/trunk:493
>
> Modified: trunk/debian/changelog
> URL: http://svn.debian.org/wsvn/reportbug/trunk/debian/changelog?rev=495&op=diff
> ==============================================================================
> --- trunk/debian/changelog (original)
> +++ trunk/debian/changelog Fri May 16 00:02:46 2008
> @@ -30,6 +30,8 @@
>     - removed Gnome BTS from bugs forward; Giridhar's patch (Closes: #439351)
>     - removed [cruft-report] option from ftp.debian.org RM template;
>       Giridhar's patch (Closes: #474970)
> +    - reintroduced 'kernel' pseudo-package, but just to fall back to
> +      'linux-image' (Closes: #423197)
>   * reportbug.py
>     - uses dpkg when dlocate can't find the package's file (Closes: #429824,
>       #422369, #322983, #408834)
> @@ -39,6 +41,8 @@
>   * reportbug
>     - explained how to reuse a saved file (generated by not submitting a bug
>       report); (Closes: #328531)
> +    - (get_other_package_name) even if 'kernel' pseudo-package is chosen, we
> +      will default on 'linux-image'
>   * reportbug.1
>     - fixed a little typo in "-i FILE, --include=FILE" options, as suggested
>       in #328531
> @@ -68,7 +72,7 @@
>   * Add security-tracker to the list of pseudo-packages, re-org the list to be
>     in alphabetical order (like it was earlier).
>
> - -- Sandro Tosi <matrixhasu at gmail.com>  Wed, 14 May 2008 09:05:32 +0200
> + -- Sandro Tosi <matrixhasu at gmail.com>  Fri, 16 May 2008 01:17:41 +0200
>
>  reportbug (3.39-0.1) unstable; urgency=low
>
>
> Modified: trunk/debianbts.py
> URL: http://svn.debian.org/wsvn/reportbug/trunk/debianbts.py?rev=495&op=diff
> ==============================================================================
> --- trunk/debianbts.py (original)
> +++ trunk/debianbts.py Fri May 16 00:02:46 2008
> @@ -160,8 +160,8 @@
>     'general' : 'General problems (e.g., that many manpages are mode 755)',
>  #    'install' : 'Problems with the sarge installer.',
>  #    'installation' : 'General installation problems not covered otherwise.',
> -#    'kernel' : '(Obsolete, please use "linux-image" instead.)',
>     'installation-reports' : 'Problems with installing Debian',
> +    'kernel' : 'IMPORTANT: Obsolete, please use "linux-image" instead (we will use linux-image even if you choose this)',
>     'linux-image' : 'Problems with the Linux kernel, or the kernel shipped with Debian',
>     'listarchives' :  'Problems with the WWW mailing list archives',
>     'lists.debian.org' : 'The mailing lists, debian-*@lists.debian.org.',
>
> Modified: trunk/reportbug
> URL: http://svn.debian.org/wsvn/reportbug/trunk/reportbug?rev=495&op=diff
> ==============================================================================
> --- trunk/reportbug (original)
> +++ trunk/reportbug Fri May 16 00:02:46 2008
> @@ -298,11 +298,17 @@
>     return package
>
>  def get_other_package_name(others):
> +    """Displays the list of pseudo-packages and returns the one selected."""
> +
>     result = ui.menu("Please enter the name of the package in which you "
>                      "have found a problem, or choose one of these bug "
>                      "categories:", others, "Enter a package: ", any_ok=True,
>                      default='')
>     if isinstance(result, basestring):
> +        # If the package selected is kernel, we replace it with linux-image
> +        # since it contains additional information useful to maintainer
> +        if result == 'kernel':
> +           result = 'linux-image'
>         return result
>     else:
>         return None


It may not be entirely clear, but the changes that are shown here
committed by me are changes that Sandro has already seen, in a
revision he committed himself.


Am I using the wrong workflow? How else should I be resolving the
situation where my branch and the Subversion repository have divergent
revisions?

How can I reconcile it *without* another user of this repository
(using Subversion) seeing a repetition of changes that already exist
in previous revisions?

-- 
 \        "I took a course in speed waiting. Now I can wait an hour in |
  `\                              only ten minutes."  -- Steven Wright |
_o__)                                                                  |
Ben Finney




More information about the bazaar mailing list