My team has a VOB in clearcase. Suppose my project looks something like this :
Project (Directory)
- Module 1 (Sub-directory)
- Module 2 (Sub-directory)
When I write my config-specs, I want to specify that if a new file is created in Module 1 sub-directory, it goes to Branch branch/LATEST, otherwise, if it is created somewhere else, I would like it to be versioned on main/LATEST.
I am able to specify that any newly created file goes to branch B using the spec:
element * /main/LATEST -mkbranch branch
Is there any way to specify the branching based on where that file is created?
From config_spec, you can use a path pattern like:
element /my_vob/module1/... .../branch/LATEST
element /my_vob/module1/... /main/LATEST -mkbranch branch
element /my_vob/module1/... /main/0 -mkbranch branch
That supposes module1 is a folder within a vob.
See "ClearCase Config Spec: load only files with specific label from certain directory" as another example.
The '/...' means folder and its content (as opposed to '*' with means only the content, not the folder itself)
The '.../branch' means branch accessed from any other branch (/main/branch, /main/anotherbranch/branch, ...)
Note that if module1 or module2 were UCM components, they could be managed in their own stream and would have their own branch.
You project could then have symbolic link to two different UCM views.
Related
I have merged the code from project/sub branch to main branch using version tree. I can see the merge arrow drawn from version at source branch to the version at destination branch.
But when I change my config spec to default config spec I can't see the folder on main branch and it still pointing to project branch.
Could you please let us know who to make it visible on main branch?
I can't see the folder on main branch and it still pointing to project branch.
check your config spec (it should include only element * /main/LATEST)
check that, as I explained before, the parent folder of the code that you have merged is also merged (also with a red arrow between project_brnch and main), or you wouldn't be able to see the merged code in /main.
I am trying to check out multiple items from two repositories. One checkout goes to the root folder, and another would be checked out to a subdirectory.
Structure:
root
source
invoice.p
compiled
invoice.r
forms
templates
invoice01.xml
invoice01.png
I right-click on the root folder and click "SVN Checkout...". I'm checking out the invoice.p and invoice.r files (specifically) with the same structure from the first repository. The checkout type defaults to "Custom Depths" and everything goes fine. The source and compiled folders show up with the check icon. Then I'm trying to get the invoice files from the second repository, but I am not sure how to check them out. I can right-click on the forms folder in my checkout directory, but no matter how I set it up, it always pulls down the wrong structure, for example:
forms
templates
forms
templates
invoice01.xml
invoice01.png
If I try to select the root folder to check out from the second repository, the original source and compiled folders get overwritten/deleted since they don't exist in the second repo. I can choose invoice01.xml and invoice01.png to go to the templates folder one at a time, but for some projects I may have 30-40 items I'd need to individually check out. Is there an easier way to check out multiple items but to ignore the folder structure?
You can't nest working copies (which is what you're attempting to do here). The lone exception is if your inner working copy is created via an svn:external pointing elsewhere.
If you create an svn:external in the repository directory root is pointing at, call it forms and point it at the URL for the forms repository, you can do what you're attempting. Otherwise, it's not possible.
To answer your query, in case the files are in the same root location like:
-forms
-templates
- invoice01.xml
- invoice01.png
They shall be checked out with the Tortoise SVN URL Repository paths separated by * (asterisk symbol) like:
forms/templates/invoice01.xml*forms/templates/invoice01.png
Thus, in one go only, these files inside the root folder would be checked out even if the actual folder of templates had other files.
In case of a different root location, different folders have to be created and checked out. No other way!
our project structure has been split. On the one hand there is the /plugins folder containing all main plugin projects. On the other hand we have a /tests folder containing all the fragment projects that are the unit tests for their corresponding main plugin projects.
Jenkins lets me check out multiple repositories, and even to the same folder in the workspace.
The problem is that the first checkout is deleted when the second URL is checked out.
/plugins is placed into the workspace directory, then the workspace directory is "cleaned":
Cleaning local Directory .
Then the second directory /tests is checked out.
Of course I want that both folder contents are placed in the same workspace directory. How can I do that?
Assuming you're using Subversion to checkout your projects, you need to specify the "Local module directory" to something other than the default for each path you are checking out.
For example;
If you have svn://myrepo/myproject/plugins and svn://myrepo/myproject/tests, the configuration would be along the lines of;
Modules:
Repository URL : svn://myrepo/myproject/plugins
Local module directory (optional) : plugins
Repository URL : svn://myrepo/myproject/tests
Local module directory (optional) : tests
This would then inform Jenkins that it has two paths to checkout and into separate locations.
If you are trying to checkout a project into the subfolder of another working copy, you may have to use svn:externals on the parent directory.
In the new Jenkins 2.0 pipeline (previously named the Workflow Plugin), this is done differently for:
The main repository
Other additional repositories
Here I am specifically referring to the Multibranch Pipeline version 2.9.
Main repository
This is the repository that contains your Jenkinsfile.
In the Configure screen for your pipeline project, enter your repository name, etc.
Do not use Additional Behaviors > Check out to a sub-directory. This will put your Jenkinsfile in the sub-directory where Jenkins cannot find it.
In Jenkinsfile, check out the main repository in the subdirectory using dir():
dir('subDir') {
checkout scm
}
Additional repositories
If you want to check out more repositories, use the Pipeline Syntax generator to automatically generate a Groovy code snippet.
In the Configure screen for your pipeline project:
Select Pipeline Syntax. In the Sample
Step drop down menu, choose checkout: General SCM.
Select your SCM system, such as Git. Fill in the usual information
about your repository or depot.
Note that in the Multibranch Pipeline, environment variable
env.BRANCH_NAME contains the branch name of the main repository.
In the Additional Behaviors drop down menu, select
Check out to a sub-directory
Click Generate Groovy. Jenkins will display the Groovy code snippet
corresponding to the SCM checkout that you specified.
Copy this code into your pipeline script or Jenkinsfile.
I am having trouble setting up a project in Mercurial with subrepos.
Goal:
I want to set up the structure like so:
-- Build_Repo (this repo will be used to track dependencies)
-- Subrepo_A (this is the main source)
-- Modules (Part of Subrepo_A)
-- Subrepo_B
So there are three repos: Build, A, and B. B is nested inside A, A is nested inside the root build repository. The build repo will be used to track dependencies, subrepo A will be used to track the main source files, and subrepo B (and others) will be used to track module/plugin development.
Problem/Question
I have no problem setting up the initial build repo and the nested Subrepo_A by simply adding the Subrepo_A path and source to the .hgsub file and committing it to the build repo. However, when after I add the subrepo_B path/source to the build repo's .hgsub, and then try to commit I get the error message:
abort: path 'Subrepo_A/Modules/Sebrepo_B' is inside nested repo 'Subrepo_A'
Mercurial doesn't appear to like a nested repo inside an already nested repo. Is this true, or am I missing something? Any better ideas on how to manage builds/dependencies?
The problem here is one of Mercurial's inescapable constraints: a repository corresponds to a folder tree on your computer. The repository is responsible for everything under that folder tree.
When your top-level repository includes a sub-repository, it hands over to the sub-repo complete control of that part of its folder structure. So the top level can't specify another sub-repository somewhere in the first sub-repos folders.
Solution 1
Subrepo_B is actually a dependency of Subrepo_A. In that case, make your repositories reflect the true dependency by editing Subrepo_A's .hgsub file to add Subrepo_B under Modules/Sebrepo_B. This works because Subrepo_A retains control over its folders.
Solution 2
Subrepo_A doesn't depend on Subrepo_B, you were putting it there for convenience. In this case, you should make both Subrepo_A and Subrepo_B be subrepos (in different locations) of the Build_Repo.
In your situation, you'll have to add subrepoB to subrepoA.
I would suggest trying to move dependencies so that your tree only has 2 levels, but that may not be possible. It's always not a very smooth experience otherwise.
I have a somewhat complicated branching structure at work (at least for me). It is something like this:
Main
|
1
|
2
| \
3 \
Ver2
|
1
| \
2 \
| ProjectA
3 |
1
There are 2 branches off of main. "Ver2" which has everyone's changes for the next version, and "ProjectA" which is my work.
My question is: Is there a way to create a config spec that knows what has been merged so I get:
Anything from ProjectA that has not been merged
If the LATEST from ProjectA has been merged to Ver2, then get the LATEST from Ver2 branch
If there is not a ProjectA branch, get from Ver2
If there is no Ver2, get from MAIN
For example, in the above case, if I merged version 1 from ProjectA to version 2 in Ver2 branch, then I would want to see version 3 on Ver2. However, if I have not yet merged those files, I would want version 1 from ProjectA in my view.
You have to remember why you define a branch:
To isolate a development effort.
So to better manage your complex config spec, you should know precisely what role play the 'main' branch, v2 branch and project A branch.
V2 and project A, for instance, should be there for two different reasons.
If Project A is there to develop the current version of the project, merges to V2 branch should occur to allow for retrofitting some of the current developments to the V2 branch.
By that reasoning, you should not want to see "both" in a same view: they represent two different set of files, V2 could include large refactorings with very different API.
However, should you insist on such a configuration, you could use the ability of moving a "MERGE_FROM_PA" label: each time you merge some files from Project A to V2 branch, you set again the "MERGE_FROM_PA" label for each merged file/directory, moving that label from previous V2 versions to their latest.
The config spec could be:
element * MERGE_FROM_PA
element * .../ProjectA/LATEST
element * .../V2/LATEST
element * /main/LATEST
But then again, that would not make much sense.
You need to define the different development efforts you want to modelize, and then define a coherent workflow, allowing your config spec to focus only on one of those environments.
I don't think you can do it quite like that. What you can get, though, is latest on ProjectA; anything on Ver2 that has not been changed in ProjectA; and anything on MAIN that has not been changed in Ver2 or ProjectA. The rest of the trick is ensuring that everything necessary has been merged from Ver2 or MAIN. For that, you can use a reference view with a config spec for Ver2 (you don't need one for MAIN unless Ver2 is not kept up to date), and then, in the ProjectA view, do:
cleartool findmerge . -fta view-tag-for-ver2 -merge
The -fta means "from tag". There are a myriad extra options, of course.
This ensures that ProjectA is fully up to date with respect to Ver2.
Why not? Not using a branch if it's been merged somewhere makes sense to me.
Here's the Config Spec:
element * {version(.../ProjectA/LATEST)&&!hltype(Merge,->)}
element * {version(.../Ver2/LATEST)&&!hltype(Merge,->)}
element * /main/LATEST
what makes this workflow incoherent, as long as you label it all before a build?