Branching with clearcase remote client - branch

I am trying to branch a file in ClearCase Remote Client.
I have the branch set up and the config spec is updated to handle the branch.
But I can't find the option, and the googling isn't helping much.

The way I understand your question, it sounds like you want to somehow select a command from a Clearcase RC menu(s) and have the branch explicitly created(?)
Clearcase has no explicit "Generate Branch for this File" command; you would want the "Checkout" command in this case. Branching is indirect and is a result of checking out a version of a file in a view that has a config spec with the '-mkbranch ' operation in it. I.e. the following config spec will create the dev_1.0_branch once I check it out (for any and all vobs and files):
element * CHECKEDOUT
element * .../dev_1.0_branch/LATEST
element * /main/LATEST -mkbranch dev_1.0_branch
The first line is standard for views in which you are doing development, line 2 will assure that I see any file that has a dev_1.0_branch (particularly important for the checkout+mkbranch to work as expected :-), and line 3 will select the latest version of any file that does not have a dev_1.0_branch and will create the branch if (and only if) the file version selected by that rule is checked out.
Please let me know if any of the above sounds greek to you, particularly any of the config spec rules. Having worked with ClearCase for a long time, I assume and use a lot of its terminology and concepts as if it's common knowledge :-P.
One thing of note: if you checkout the file, then immediately uncheckout the file, you will leave an empty branch on that file (i.e. in the above you would have a file with a version such as: foo.c##/main/dev_1.0_branch/0, but no /main/dev_1.0_branch/1 version). Many sites prefer to keep the version tree clean and remove empty branches (one can be found in this IBM Rational Technical article)
Just to be clear, I'm familiar with ClearCase Base & ClearCase MultiSite, but have not worked with the Remote Client yet.
--- 2009-Jun-29 Update
In response to Paul's comment below, if you want to be selective in what files are branched, you can modify the "*" to be more specific. For example, if you want to only branch foo.c in the FOODEV VOB, but leave everything else on main:
UNIX config spec:
element * CHECKOUT
element * .../my_dev_branch/LATEST
element /vobs/FOODEV/src/foo.c -mkbranch my_dev_branch
element * /main/LATEST
(For windows, you would want to use Windows conventions. I.e. \FOODEV\src\foo.c).
You can also select a directory and all elements below the directory (again UNIX config spec):
element * CHECKOUT
element * .../my_dev_branch/LATEST
element /vobs/FOODEV/src/mycomponent/... -mkbranch my_dev_branch
element * /main/LATEST
The main page for config_spec (cleartool man config_spec from the command line on windows or unix) provides decent guidance in the "Pattern" section for how to write the element/version selector (2nd column).
You can do a lot of complex version selection with the config specs. Please let me know if you would like more details or specifics.

Here's a config spec that I used for fixing a particular bug, with names changed to disguise some of the guilty.
element * CHECKEDOUT
element * .../TEMP.bugnum171238.jleffler/LATEST
mkbranch -override TEMP.bugnum171238.jleffler
include /clearcase/cspecs/project/version-1.23.45
To create the branch, in each VOB, I used a command:
ct mkbrtype -c 'Branch for bug 171238' TEMP.bugnum171238.jleffler#/vobs/project
Previously, we used config specs with -mkbranch rules appended to the various element lines.

Related

How to calculate a module's dist hash

I have Perl 6 installed in ~/.rakudo-star/rakudo-star-2018.04, using LoneStar. When zef installs a module, it gets installed into a subdirectory of the Rakudo Perl 6 directory. In here is a directory named perl6/site/resources, which seem to hold all the installed files. How can I figure out which module is contained in which file, using Perl 6?
If you want to get the source of a namespace that would get loaded you can do:
my $module-name = 'Test';
# Get a Distribution object which provides an IO interface to its contents
my $compunit = $*REPO.resolve(CompUnit::DependencySpecification.new(:short-name{$module-name}));
my $distribution = $compunit.distribution;
my $handle-from-name = $distribution.content($distribution.meta<provides>{$module-name}.keys[0]).open;
say $handle-from-name.slurp(:close);
# Or if we already know the name-path:
my $handle-from-path = $distribution.content("lib/Test.pm6").open;
say $handle-from-path.slurp(:close);
Note that $compunit.distribution will only work if resolve returned a CompUnit from a CompUnit::Repository::Installation repository.
rakudo#1812 is the framework to improve this further, allowing individual repositories to be queried ( $*REPO.resolve iterates the linked list of repos to give a result ) and unifying behavior for resolve/candidates/etc between CompUnit::Repository::Installation and CompUnit::Repository::FileSystem.
If I remember correctly, you shouldn't. It's zef the one that must take care of it. But if you positively have to, use the SHA1 signatures in the directory with zef locate
zef --sha1 locate 5417D0588AE3C30CF7F84DA87D27D4521713522A
will output (in my system)
===> From Distribution: zef:ver<0.4.4>:auth<github:ugexe>:api<>
lib/Zef/Service/Shell/PowerShell/download.pm6 => /home/jmerelo/.rakudobrew/moar-2018.06/install/share/perl6/site/sources/5417D0588AE3C30CF7F84DA87D27D4521713522A
From your question, it's not too clear if what you want to do is the opposite, that is, find out which SHA1 corresponds to which file; in that case, try and to this:
zef locate bin/lwp-download.pl
which will return
===> From Distribution: LWP::Simple:ver<0.103>:auth<Cosimo Streppone>:api<>
bin/lwp-download.pl => /home/jmerelo/.rakudobrew/moar-2018.06/install/share/perl6/site/resources/059BD7DBF74D1598B0ACDB48574CC351A3AD16BC

How to apply diff rules of the languages in gitattributes

For example, the .gitattributes file of lg2s has the line *.cs diff=csharp. the output of the codes
using (var repo = new Repository(#"path\to\lg2s"))
{
var tree1 = repo.Lookup<Commit>("a845db9").Tree;
var tree2 = repo.Lookup<Commit>("d677741").Tree;
var patches = repo.Diff.Compare<Patch>(tree1, tree2);
foreach (var patch in patches)
{
Console.WriteLine(patch.Patch);
}
}
is (shortly)
diff --git a/LibGit2Sharp/RepositoryStatus.cs b/LibGit2Sharp/RepositoryStatus.cs
## -59,8 +59,8 ## namespace LibGit2Sharp
but the output of git bash is (shortly)
diff --git a/LibGit2Sharp/RepositoryStatus.cs b/LibGit2Sharp/RepositoryStatus.cs
## -59,8 +59,8 ## internal RepositoryStatus(Repository repo, StatusOptions optio
the second line not same.
Looks like there are an in-depth discussion Add .gitattributes support libgit2/#508, but the PR Add APIs for git attributes libgit2/#516 is merged or not?
How many languages were supported now?
Can we specify the rules without gitattributes file?
This is actually an issue of diff drivers and custom function context rules for diffs, not one of attributes.
Those files do have the diff=csharp attribute; the problem is that the attribute doesn't mean anything to libgit2.
When git and libgit2 generate diffs, they use regular expressions to find the name of the function in which a diff hunk occurs. They also have a fallback rule if no regular expression is available to find the first line that did not start with whitespace.
git contains a table of built in diff drivers that includes a definition of the csharp driver.
libgit2 does not contain that table (as discussed in the PR that merged diff driver support) and hence has no built in notion of what pattern to use for diff=csharp.
Your alternatives for solving this are either:
Make an entry in your .git/config file (or your $HOME/.gitconfig) that implements diff.csharp.xfuncname with a pattern to search, or
Start a Pull Request to libgit2 that imports the driver definitions. The issue with importing (and the reason I didn't take it on) is that it will involve getting permission from the original authors of the code to relicense it for use in libgit2).
If you decide to start a Pull Request and you get the author of the CSharp xfuncname patterns to agree to relicense the code for libgit2, let me know and I'll be happy to collaborate on the actual implementation!

Issue with clearcase branch per task strategy

I have a problem here with the branch per task strategy in clearcase.
We are using snapshot views. We have various task branches and an integration branch.
So, we merge the branches to integration for testing.
Now, suppose I am working on a file on BR1 which is merged to integration branch and this file refers to another file which is not merged to integration branch but BR2 for the second file is merged to integration branch.
So, second file is pointing to the BR2 edition of the file whereas I didn't want those changes but since I am taking all other code from integration branch, its taking that version.
This is my config spec:
element * CHECKEDOUT
element * .../BR1/LATEST
element * .../integration/LATEST -mkbranch BR1
element * /main/LATEST -mkbranch integration
element * /main/0 -mkbranch integration
Is there any way to resolve? One way I could think of is putting a label so ,change the config spec to pick from that label and not from latest of integration branch but that would need changing the labels as the work gets progressed in the task branches.is there any other way we could do this?
The integration branch is there to integrate, so if you are doing work from that branch, I would really advise you to take all those files.
If the issue is only for one file, you simply can try a "cherry-pick" approach, and checkout that file in your current BR1 branch, replacing its content with any other version you want (with a cleartool get, for instance, as detailed in "Clearcase command to export an element").
Considering your config spec, I would recommend:
putting a label 'L_BR1' just after merging BR1 to Integration,
select that label over the LATEST of Integration (which contains version merged from BR2)
That would mean a config spec like:
element * CHECKEDOUT
element * .../BR1/LATEST
element * .../integration/L_BR1 -mkbranch BR1 <=== add this select rule
element * .../integration/LATEST -mkbranch BR1
element * /main/LATEST -mkbranch integration
element * /main/0 -mkbranch integration
Caveat: be ware, though, that it wouldn't work well on cross-integrations (when you merge BR1 to Integration, then BR2, then again BR1)

extra-paths not added to python path with zc.recipe.testrunner

I am trying to run tests by adding a version of tornado downloaded from github.com in the sys.path.
[tests]
recipe = zc.recipe.testrunner
extra-paths = ${buildout:directory}/parts/tornado/
defaults = ['--auto-color', '--auto-progress', '-v']
But when I run bin/tests I get the following error :
ImportError: No module named tornado
Am I not understanding how to use extra-paths ?
Martin
Have you tried looking into generated bin/tests script if it contains your path? It will tell definitely if your buildout.cfg is correct or not. Maybe problem is elsewhere. Because it seem that your code is ok.
If you happen to regularly include various branches from git/mercurial or elsewhere to buildout, you might be interested in mr.developer. mr.developer can download and add package to develop =. You wont need to set extra-path in every section.

Using sub-repo with hgwebdir difficulties in mercurial

Allright I got myself in a deadlock with Mercurial and sub-repos... Here's what happenend:
I had a large mercurial repo that I server via apache and hgweb.cgi.
Due to the size of the repo I decided to move to sub-repositories and share these with hgwebdir.cgi.
Using the convert tool with the filemap option I created several sub-repositories:
/main/foo
/main/bar
Nicely created an entry for the sub-repositories in .hgsub:
foo = foo
bar = bar
And set hgwebdir.cgi up to show $/** as the root folder.
Now when I went to my site (foo.com/hg) I saw my sub-repositories with one empty reposory among them (no name, no content), but I could not download it (archive location unknown):
empty_repo http://img707.imageshack.us/img707/8237/emptysubrepo.png
That was allright until I added a new sub-repository.
I could not push the new .hgsub file to foo.com/hg, since that page is served by hgwebdir.
The only method I can work currently is switch from hgwebdir to hgweb, commit .hgsubste and switch back to hgwebdir.
Does someone have a good setup for such a mess?
On the webserver your main and its subrepos should appear as siblings -- not with the subrepos inside main.
Main
ASCII
AlignDistribute
And the URLs in your .hgsub should look like:
ASCII = ../ASCII
AlignDistribute = ../AlignDsitribute
Then you'll be able to push/pull to http://foo.com/hg/Main and when you clone it the clone/update will automatically attach and clone down the separate subrepos.
From what I've read on https://www.mercurial-scm.org/wiki/PublishingRepositories#multiple
The keys (on the left) and the values (on the right) are both filesystem paths
The keys should be prefixes of the values and are "subtracted" from the values in order to generate the URL paths to each repository
What I'm guessing happened is that in your hgweb(dir) configuration you're specifying the same value for a collection possibly as the key, so during subtraction it ends up with a blank name and no way to get to it.
When I use [collections] to set /a/full/path = /a/full/path directly to a repo, it'll end up blank too, because it's reading that folder as a repo because it is a repo, instead of each sub-directory being an individual repo, after I removed the .hg folder and .hgsubs and everything from the root of my collection entry, all the subfolders started showing up properly.
I originally used in [paths], /path/to/my/project = /path/to/my/project, and since that is a single referenced repository, it'll subtract the value from the key, leaving you once again with '', instead I used project = /path/to/my/project and it came out as 'project'.
Hopefully that URL or these descriptions will get you out of your pickle!