Git Product home page Git Product logo

cms-git-tools's Introduction

cms-git-tools

CMS Git Helpers

INSTALL

These helpers should be part of any release since CMSSW_7_0_0_pre0. If you want to use them standalone, just clone this repository and add it to your PATH.

cms-git-tools's People

Contributors

aledegano avatar fwyzard avatar iarspider avatar kpedro88 avatar ktf avatar mrodozov avatar slava77 avatar smuzaffar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cms-git-tools's Issues

please create a "public" OAuth API key

git-cms-init uses the GitHub API to check if a user has properly setup his or her repository.
Anonymous queries are limited to 60 per hour per machine - which may sometimes become a problem on shared machines like lxplus.
Authenticated queries have a much higher limit (5000 per hour), making it much less lilely to run into it.

Would it be possible to create one "public" API key for the cms-sw user, without any access to any scope, to be used by the git-cms-init queries ?

For the moment I will set it up to use a similar key for my account, but it would be more sensible to have one from cms-sw.

cms-addpkg doesn't recognize CMSSW_6_1_X_SLHC branch

In CMSSW_6_1_2_SLHC6_patch1:

git cms-addpkg L1Trigger/CSCTriggerPrimitives

No release tags specified, using default CMSSW_6_1_2_SLHC6_patch1.
You are on branch CMSSW_6_1_X
[.. then it fails with ]
fatal: Cannot update paths and switch to branch 'from-CMSSW_6_1_2_SLHC6_patch1' at the same time.

This "You are on branch CMSSW_6_1_X is wrong

Do not use /dev/stdout or stderr, running under sudo fails with permission errors.

Hi,

The scripts should not use /dev/stderr for redirection,
It's a bad practice and it causes troubles for sudo/cron/whatever users (Permission denied).

This happens because:

echo a >&2
echo a >/dev/stderr 

are different - the later will try to open a file named /dev/stderr and it will fail,
because the sudo user does not have the access rights to the pts.
In other words, &2 can be duplicated and written to it, but it cannot be re-openned.

The "workaround" is to run the scripts either with -q option,
or create virtual stdin/stdout via redirection: git-cms-init -ssh 2>&1 | cat .

Ideally, scripts should never open /dev/stderr or /dev/stdout, but if the redirection is necessary,
it should be done via exec:
echo a >somefile should become
exec >somefile; echo a
or if some special stream is necesarry, exec 5>test; echo "hello" >&5

I can modify the scripts to remove "git-command >DEBUG_STREAM" style redirections,
reimplement "-q" and similar options via "exec 1> /dev/null". That might change the output
and I have no idea whether it won't break other scripts.

Dmitrijus

user.github vs github.user in gitconfig

I am wondering why CMS uses "use.github" rather than "github.user" in its git configuration.

This faq page
http://cms-sw.github.io/cmssw/faq.html
instructs users to run
$ git config --global user.github

However, it is more common to do
$ git config --global github.user
see for example https://github.com/blog/180-local-github-config

As a result, in my ~/.gitconfig, I have two entries about the same information:

[user]
github = TaiSakuma
[github]
user = TaiSakuma

In fact, if I google "git config --global user.github", I receive only 5 results and all are in CMS. On the other hand, if I google "git config --global github.user" , I get more than 25,000 results.

git-cms-rmpkg

Simply removing the package from the local checkout area, now, will mean that the user wants to remove a given package. We need a git-cms-rmpkg which does the following:

  • reset the given package to the original CMSSW_VERSION tag.
  • removes the packages entry from .git/info/sparse-checkout
  • invokes read-tree again.

Check if a package exists before doing the read-tree

@ferriff had an issue where he got the following:

git cms-addpkg RecoLocalCalo/EcalRecProducer CMSSW_6_2_0_pre8
CMSSW environment not found. Checking out packages in /tmp/ferriff/src
You are on branch CMSSW_6_2_X
Checking out RecoLocalCalo/EcalRecProducer in tag CMSSW_6_2_0_pre8
error: Sparse checkout leaves no entry on working directory
fatal: Could not reset index file to revision 'CMSSW_6_2_0_pre8'

the actual error is a missing s in the name of the package, however the error message does not help. Maybe fix this by checking the index before doing the read-tree?

checkdeps should check the base and local code are consistent

If in base release aRel I do "cms-addpkg Pack bRel"
as a first checkout, my local .git will have a fork-point from bRel.
checkdeps will get the list of dependencies from the base and then
call git read-tree bRel. This is inconsistent.
In fact, I think checkdeps should really make sure that the depencies are taken from the base release repository.

Add conflict resolution options to git-cms-merge-topic.

From @vadler

git-cms-merge-topic is a very useful tool, but it lacks the
functionality to continue after solvinf conflicts so far. Usually, I
solve the conflicts, commit the solutions and execute the lines after
'git merge --no-ff [...]' manually.
It would be great, if a corresponding option "-c/--continue" (and also
"-a/--abort") could be added.

git cms-remote

Hi,
can we add a git cms-remote command, with limited functionality ?
I would like to be able to do

git cms-remote add fwyzard

as a shortcut for

git remote add fwyzard https://github.com/fwyzard/cmssw.git
git remote set-url --push fwyzard [email protected]:fwyzard/cmssw.git

(possibly with support for the --ssh and --https options as in git cms-init to force using only ssh or only https)

git-cms-addpkg and new packages

I just encountered the following situation:

  1. checkout a CMSSW release as usual, call git cms-init
  2. create a new package, add & commit files inside the new package
  3. call git cms-addpkg to get an existing package

The result is that the tracked files from the new package are removed from the working directory by the sparse checkout that occurs when git cms-addpkg is called. (I had to call git cms-addpkg for the new package to get the files back.)

I'm not immediately sure if there's a way to resolve this problem. Maybe the first time git cms-addpkg is called (identified by the sparse-checkout file having default contents?), it could call git cms-sparse-checkout, similar to what the git cms-[]-topic commands do.

how to choose another location for the reference repository?

Hi,

I am a really new user of git and I try do "git cms-addpkg PhysicsTools/PatAlgos".
I haven't defined my reference repository, and I allow git to create it.
The problem is that I don't have enough space in my home. So it crashes.

Then I try to make a symbolic link from .cmsgit-cache to another disk, but then I receive the message saying that my reference repository is not a local directory.

Then I try to define directly another location with "export CMSSW_GIT_REFERENCE=blablabla". But when trying "git cms-addpkg", it tells me again that this is not a local directory.

Each time, it removes the src directory of my CMSSW release.

Could you help me?

Thanks in advance,
Caroline

make addpackage check the current dir is inside of CMSSW_BASE

I sometimes forget to cmsenv before running git, after switching from another release area.
Current behavior of cms git tools (cms-addpkg) will make changes
to the old release area, making silently quite a mess.
Please add a check that the current dir is inside of CMSSW_BASE

git-cms-addpkg resets staged (but not yet commited) changes without a warning.

Hi,

If you do git-cms-addpkg, all staged (but not yet committed) changes will be reset without a warning.

> git-cms-addpkg RecoLocalCalo
> touch RecoLocalCalo/test
> git add RecoLocalCalo/test
> git status
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#   new file:   RecoLocalCalo/test
#
> git-cms-addpkg EventFilter
> ls -la RecoLocalCalo/test
ls: RecoLocalCalo/test: No such file or directory
> git status
nothing to commit, working directory clean

Dmitrijus

"You don't seem to have a personal repository," when I do have a personal repository

"git cms-init" gives me the following message.

You don't seem to have a personal repository, or your GitHub username (TaiSakuma) is not correct.
You can work locally, but you will not be able to push your changes to GitHub for inclusion 
in the official CMSSW distribution.

You can correct your GitHub user name via:

    git config --global user.github <your github username>


To create a personal repository:
  - go to https://github.com/ and log in
  - go to https://github.com/cms-sw/cmssw and click on the Fork button
  - select the option to fork the repository under your username (TaiSakuma)

However, I do have a personal repository and my GitHub username (TaiSakuma) is correct.

The problem seems to be "curl" used at
https://github.com/cms-sw/cms-git-tools/blob/master/git-cms-init#L273
In a cmsenv, "curl" is installed at $VO_CMS_SW_DIR/osx108_amd64_gcc481/cms/cmssw/CMSSW_7_0_0_pre8/external/osx108_amd64_gcc481/bin/curl

If I manually execute this command without "-q" (quiet) option in a cmsenv as

$ curl -s "https://api.github.com/users/TaiSakuma/repos" | tee /dev/null | grep '"name": *"cmssw"'

nothing will be shown.

However, if I use, for example, "curl" from MacPorts:

$ /opt/local/bin/curl -s "https://api.github.com/users/TaiSakuma/repos" | tee /dev/null | grep '"name": *"cmssw"'
    "name": "cmssw",

Then it prints '"name": "cmssw",'.

Testing PRs from non cms-sw/cmssw repositories

Currently cms-merge-topic and cms-checkout-topic only work with pull requests of cms-sw/cmssw. In order to test PRs from non-cms-sw/cmssw repositories we need to support something like

git cms-mergc-topic gh_user:PR_NUM
git cms-checkout-topic gh_user:PR_NUM

git cms-addpkg gives unclear error message when package not found

A call to "git cms-addpkg Foo/Bar" in a Vanilla CMSSW project area gives an unclear error message:
...
bash-4.1$ git cms-addpkg Foo/Bar
No release tags specified, using default CMSSW_7_0_0_pre1.
You are on branch CMSSW_7_0_X
Checking out Foo/Bar in tag CMSSW_7_0_0_pre1.
Cloning into '/build/hauth/cmssw/TrackingMat/CMSSW_7_0_0_pre1/src'...
remote: Counting objects: 620, done.
remote: Compressing objects: 100% (231/231), done.
remote: Total 305 (delta 215), reused 162 (delta 74)
Receiving objects: 100% (305/305), 102.36 KiB | 0 bytes/s, done.
Resolving deltas: 100% (215/215), completed with 154 local objects.
error: Sparse checkout leaves no entry on working directory
fatal: Could not reset index file to revision 'CMSSW_7_0_0_pre1'.

This will happen only if there have not been any other (valid) packages added. After adding valid packages, the output is more clear:

bash-4.1$ git cms-addpkg Foo/Bar
No release tags specified, using default CMSSW_7_0_0_pre1.
You are on branch CMSSW_7_0_X
Checking out Foo/Bar in tag CMSSW_7_0_0_pre1.
Error: package Foo/Bar does not exist in tag CMSSW_7_0_0_pre1.

Thanks,
Thomas

Using --https option fails when creating the reference repository.

Tai has a problem on his mac:

$ git cms-addpkg RecoMET/METProducers
No release tags specified, using default CMSSW_7_0_0_pre0.
You are on branch CMSSW_7_0_X
Checking out RecoMET/METProducers in tag CMSSW_7_0_0_pre0.
Your reference git repository does not seem to exist, would you like
to create it? [ y / N / ? ] yCloning into bare repository
'/Users/sakuma/.cmsgit-cache'...
fatal: unable to access 'https://github.com/cms-sw/cmssw.git/': SSL
certificate problem: unable to get local issuer certificate

the --https option would probably solve this issue, however it's apparently not working correctly.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.