Jump to content

Script to export all branches


cidico

Recommended Posts

Hi cidico,

Here's a quick batch file I put together to try this out (note I am using Plastic 3.0):

@echo OFF

setlocal ENABLEDELAYEDEXPANSION

REM Define path for replication package files produced

set pkg_path=C:\PlasticSCM\Triggers

REM Get repo name, server name, server port from batch arguments

set repo_name=%1

set server_name=%2

set server_port=%3

REM For each branch in specified repo, create replication package in path defined above

for /f "usebackq tokens=*" %%a in (`cm find branch on repositories '%repo_name%' --nototal "--format={name}"`) do (

set branch_name=%%a

set src_branch="br:!branch_name!@rep:%repo_name%@repserver:%server_name%:%server_port%"

set branch_pkg=!branch_name:/=_!

set pkg_name="%pkg_path%\%repo_name%!branch_pkg!.rep"

echo.

echo Creating replication package !pkg_name! for source branch !src_branch!:

cm replicate !src_branch! --package=!pkg_name!

)

It takes 3 args: repo name, server name, server port; and generates .rep files in the directory defined (change that to your favorite location). Files are named after repo and its branches; so if you repo is Code and your branches are /main and /main/fred, it will produce Code_main.rep and Code_main_fred.rep.

Hope this helps!

Dean

Link to comment
Share on other sites

Simple and straight to the target!

We definitively need a site to publish this kind of contributions....

Thanks deanaug!

Maybe just a separate forum on this site, similar to the way you've broken out things like branching/merging and selectors into their own forums to make them easier to find.

Otherwise these tend to get "lost in the sauce" as we say here.

Link to comment
Share on other sites

  • 4 years later...

Well this is some kind of experimental stuff and it's not 100% public but since it can't hurt here it goes:

cm replicate /main@repo@srcserver:8087 mirror@dstserver:8087 --clone

Although a source branch is specified in the command syntax, it will replicate the whole repository.

 

It's available from the release 5.4.16.704.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...