[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Reoganizing svn structure and error "shares no common ancestry"

From: Eric Johnson <eric_at_tibco.com>
Date: Thu, 19 Mar 2015 09:45:42 -0700

You can't do a "reorg", but you could possibly recreate the branches.

Perhaps a pain, but you certainly could build a script that iterates
through the changes on your branch, and recreates them by taking advantage
of Subversion's three way merge functionality (using --ignore-ancestry!).

More specifically:

1) identify the point in history on the old branch where it exactly matched
trunk

2) Create new branch from that point in time that you just identified

3) Do a log on the old branch, identifying each change that was applied to
the branch.

4) Checkout a working copy of the new branch

5) For each revision on the *old* branch, do a three way merge followed by
commit (make sure you're in the working copy for the new branch!):

svn merge --ignore-ancestry -r___:___ /branches/oldbranch

You'll need to walk through each revision in the old branch. Start with the
branch point revision # to first change revision #. Then first change
revision # to second change revision #. Etc.

Make sense?

Eric.

On Thu, Mar 19, 2015 at 4:34 AM, Buddy Butterfly <buddy.butterfly_at_web.de>
wrote:

>
> thanks for explanation.
> Yes, indeed it looks like the branches have not been branched from trunk.
> So there is no way to reorg and get the "old" branches to be recognized as
> correct branches? I did a test and branched from the new trunk and copied
> that content of the old branch into it. Now the branch is detected as such
> and it can be switched to from trunk. But this means we would have to redo
> manually all branches and tags etc? I was hoping there is some other way.
>
> Am 18.03.2015 um 22:01 schrieb Bert Huijben:
> >
> > You can avoid the error by passing --ignore-ancestry to switch… but that
> doesn’t fix the ancestry problem
> >
> >
> >
> > What it tries to tell you is that the branches were not created from
> trunk.
> >
> >
> >
> > Usually you would
> >
> > * create trunk
> >
> > * apply some changes to trunk
> >
> > * copy that to a branch
> >
> > * apply some changes to trunk
> >
> > * copy that to a branch
> >
> > * update trunk….
> >
> > *…
> >
> >
> >
> > That way the branches share ancestry with trunk (and thereby with each
> other). Further updates on the branches are possible, but they still share
> (some) history, as they all originated from the original trunk.
> >
> >
> >
> >
> >
> > Your script says that you created the branches as new, so Subversion is
> right that the branches don’t share ancestry with trunk. Usually you only
> want to switch between related branches. (A common error is to branch to
> the wrong directory level. This is caught by this check). The
> --ignore-ancestry override works for those cases that there is no shared
> ancestry… but this might tell you that everything will be deleted and
> checked out clean (depends on more things), so perhaps in some cases just
> deleting and a clean checkout may be faster.
> >
> >
> >
> > Bert
> >
> >
> >
> > *From:*Eric Johnson [mailto:eric_at_tibco.com <eric_at_tibco.com>]
> > *Sent:* dinsdag 17 maart 2015 23:14
> > *To:* buddy.butterfly_at_web.de
> > *Cc:* users_at_subversion.apache.org
> > *Subject:* Re: Reoganizing svn structure and error "shares no common
> ancestry"
>
> >
> >
> >
> > Does switching to a new branch work before the reorganization that you
> did?
> >
> >
> >
> > What version of Subversion are you using?
> >
> >
> >
> > Can you reproduce the problem with a mock version of your repository?
> >
> >
> >
> > When you do an svn log of your new branch, does the history go back to a
> common revision with the new trunk? Likewise, with your new trunk, does an
> svn log show a common revision with the branch?
> >
> >
> >
> > Eric
> >
> >
> >
> >
> >
> > On Mon, Mar 16, 2015 at 3:18 AM, Buddy Butterfly <buddy.butterfly_at_web.de
> <mailto:buddy.butterfly_at_web.de> <buddy.butterfly_at_web.de>> wrote:
> >
> >
> > Hi,
> >
> > finally we would like to restructure our badly structured svn repo.
> > Over time a lot of stuff flew into this repo. I have used kdesvn for
> > moving the trees online in the repo. kdesvn does a copy and delete
> > when moving. I have also tried to use a svn move. Steps were as
> follows:
> >
> > 1. Created a new repo path to the project.
> > 2. Created branches, tags and trunk below ist.
> > 3. Moved (like described above) original project below the new trunk.
> > 4. Similar like 3. for branches with creating the branches/<branch>
> and
> > moving the old branches to the new ones.
> > 5. Checked out the new trunk.
> > 6. Tried to switch to one of the new branches.
> >
> > Step 6. always give the error switching not possible "shares no
> common
> > ancestry".
> >
> > The moving like described above is very convenient and would allow
> the reorg
> > in an acceptable time frame. How is it possible to do this and
> create or
> > manipulate the history such that a common ancester will be created?
> >
> > Do you propose another workflow to acomplish this in an easy way?
> >
> > Thanks a lot and cheers,
> > Buddy
> >
> >
> >
>
>
>
>
Received on 2015-03-19 18:12:48 CET

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.