Jump to content

Refactor single repository into two with an xLink keeping history.


andsee

Recommended Posts

We have a workspace for a whole project, part of this turns out to be re-usable and as such we want to move it out of it's current repository into it's own and setup an xLink so that the existing repository uses the library from it's new location. We shall then also set up xLinks to use the library in 2 new project repositories.

 

The question is how can I move a directory (with history) from one repository to another?

 

One approach that I've considered is to copy the whole existing repository (somehow) and the move the relevant library directory to the root and delete the rest of the repositories' content.

 

What's the best approach, is there support for this kind of refactoring?

 

Andrew.

 

Link to comment
Share on other sites

Hi,

 

It´s not possible to move the history of a directory between repositories. If you want to use a folder of a repository in a different one, a good approach could be:  create a Xlink to the repository that contains the folder. Then you can play with cloaking rules in order to update only the desired folder in your workspace and not the rest of the content.

 

 This way, you workspace would contain your own code plus the folder linked from a different repository.

 

 

Regards,

Carlos

Link to comment
Share on other sites

  • 3 weeks later...

Would the following approach work?

 

Duplicate the repository database and then add it as a new 'lib' repository via cm addrep.  <-- This is the main bit I'm not sure if it is safe to do.

 

Delete all files that we don't want in the xlink area from the 'lib' repository and shift the directory we are interested in to the root.

 

Now delete the directory we have in 'lib' from the original repository.

 

Hopefully I can then xlink the contents of 'lib' back into the original repository and have the history?

 

I guess one downside of this is that the 'lib' repository will also contain the whole of the original project in it's history but I'm ok with that if it's the only downside.

Link to comment
Share on other sites

  • 1 year later...

Hi,

 

The approach to link repositories in Plastic is using Xlinks. If you don´t want to download the entire linked repository, you can configure cloaked rules to download to your workspace only the desired files.

 

PD: Another possibility could by to replicate the library repo into a new clean repository, but only including the desired branches.  Theis was you can "clean up" the repository  including only some specific branches.

 

Regards,

Carlos

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...