Add repository directory to existing branch in CVS - branch

I have the following structure in my CVS respository
ProjectX
|--> DirectoryA
| |--> DirectoryA1
| |--> DirectoryA2
| |--> DirectoryA3
|--> DirectoryB
. .
. .
And I creted branch1 only for DirectoryA3:
branch1:
ProjectX
|--> DirectoryA
|--> DirectoryA3
I forgot to add DirectoryA1 and DirectoryA2 and I want to add them to the branch to get this:
branch1:
ProjectX
|--> DirectoryA
|--> DirectoryA1
|--> DirectoryA2
|--> DirectoryA3
What are the cvs commands needed to accomplish that?

Solved with the following:
cvs tag -r TAG-USED-WHEN-CREATING-THE-BRANCH -b branch1 ProjectX/DirectoryA/DirectoryA1
cvs tag -r TAG-USED-WHEN-CREATING-THE-BRANCH -b branch1 ProjectX/DirectoryA/DirectoryA2

Related

batch: create relative folders based on archives name and only then extract multiple .rar archives in their respective folder

I have these .rar/zip archives into C:\test
test1.rar
test2.rar
Inside test1.rar I haven't folders, just files while in test2.rar I have also a folder inside
I try to extract every rar/zip archives into relative folders with archive content into C:\test2. I want to use same name of archives for relative folder name
test1 <-- in this folder there are only files because test1.rar had not folders within
test2 <-- content should extracted preserving structure folder inside archive
Script that I use is this
#echo off
set "SourceFolder=C:\test"
set "TargetFolder=C:\test2"
if not exist "%TargetFolder%" md "%TargetFolder%"
"C:\Program Files (x86)\WinRAR\Rar.exe" x -cfg- -idq -r -y "%SourceFolder%\*.rar" "%TargetFolder%"
del /F /Q /S "%SourceFolder%\*.rar">nul
for /D %%D in ("%SourceFolder%\*") do rd "%%D" 2>nul
but this script works bad
After extraction this script delete my .rar archives from Source Folder, but I don't want this
It doesn't create test1 folder before to move test1.rar content inside test1 folder. It simply extract content
THIS is output that I expected
C:\test2
|
|--- test1 [folder]
| |
| |--a.txt
| |--b.txt
|
|--- test2 [folder]
|
|--simple [folder]
| |
| |- c.txt
|
|-d.txt
But I get this bad output
C:\test2
|
|
|--a.txt
|--b.txt
|--simple [folder]
| |
| |- c.txt
|
|-d.txt
Solution is this. Thanks to #Mofi for -ad switch
#echo off
set "SourceFolder=C:\temp"
set "TargetFolder=C:\temp2"
if not exist "%TargetFolder%" md "%TargetFolder%"
"C:\Program Files\WinRAR\Rar.exe" x -ad -cfg- -idq -r -y "%SourceFolder%\*.rar" "%TargetFolder%"
for /D %%D in ("%SourceFolder%\*") do rd "%%D" 2>nul

Clone all projects from cgit

I have to download all projects that are hosted on some cgit instance. There are several hundreds of repositories, so it is tedious to do this manually.
How can it be done?
Seems that it is possible to do it with curl by parsing pages one by one. By is there more convenient interface?
There does not seem to be any official or convenient API for CGit to export/clone all its repositories.
You can try those alternatives:
curl -s http://git.suckless.org/ |
xml sel -N x="http://www.w3.org/1999/xhtml" -t -m "//x:a" -v '#title' -n |
grep . |
while read repo
do git clone git://git.suckless.org/$repo
done
Or:
curl -s http://git.suckless.org/ | xml pyx | awk '$1 == "Atitle" { print $2 }'
Or:
curl -s http://git.suckless.org/ | xml pyx | awk '$1 == "Atitle" { printf("git clone %s\n",$2) }' | s
I suspect this work for one page of Git repositories as listed by CGit: you might still have to repeat that for all subsequent Git repositories pages.

I have a problem with it when i use Powerlevel10k which is a theme for ZSH?

I have a problem with it when i use Powerlevel10k which is a theme for ZSH?
From the Powerlevel10k FAQ:
Q: What do different symbols in Git status mean?
When using Lean, Classic or Rainbow style, Git status may look like this:
feature:master ⇣42⇡42 *42 merge ~42 +42 !42 ?42
Legend:
| Symbol | Meaning | Source |
| --------| ------------------------------------------------------------------| ---------------------------------------------------- |
| feature | current branch; replaced with #tag or #commit if not on a branch | git status |
| master | remote tracking branch; only shown if different from local branch | git rev-parse --abbrev-ref --symbolic-full-name #{u} |
| ⇣42 | this many commits behind the remote | git status |
| ⇡42 | this many commits ahead of the remote | git status |
| *42 | this many stashes | git stash list |
| merge | repository state | git status |
| ~42 | this many merge conflicts | git status |
| +42 | this many staged changes | git status |
| !42 | this many unstaged changes | git status |
| ?42 | this many untracked files | git status |
See also: How do I change the format of Git status?
If you've created a Git repository at the root of your home directory to store dotfiles, you probably want to ignore untracked files in it. You can achieve this by executing the following command:
git -C ~ config status.showuntrackedfiles no
This will have several effects:
git status will be faster.
git status won't list 171 untracked files.
?171 will disappear from your prompt.
You can undo the above command with the following command:
git -C ~ config --unset status.showuntrackedfiles
if you don't want to see Git status in your prompt while in home directory, add this parameter to ~/.p10k.zsh:
# Don't display Git status in prompt for Git repositories whose workdir matches
# this pattern.
typeset -g POWERLEVEL9K_VCS_DISABLED_WORKDIR_PATTERN='~'
If you don't want to see Git status in your prompt at all, remove vcs from POWERLEVEL9K_LEFT_PROMPT_ELEMENTS array in ~/.p10k.zsh.

jq json tree traversal (npm node_modules)

The question concerns the code optimization.
I want to define a json-file which specify what files will be copied and where. Namely, I want to apply it in npm-type project to transfer the files from node_modules to the destination directory from which I include files (on the templates of the pages for the web browser). So I wrote a json file:
{
"public": [
{
"bootstrap": {
"js": [
"bootstrap.min.js"
],
"css": [
"bootstrap.min.css"
]
}
},
{
"jquery": {
"js": [
"jquery.min.js"
]
}
}
]
}
The first level defines the name of the destination directory ('public') which would contain the packages specified on the second level. The third level defines the names of the destination folders inside 'public' ('js' or 'css') which contain the list of files to find and copy.
The code which traverses the json file follows:
#!/usr/bin/env bash
cfg='push2public.json'
P=$(cat "$cfg" | jq keys[0] -r)
n=$(cat "$cfg" | jq ".$P | length")
for (( i=0;i<$n;i++ )); do
p=$(cat "$cfg" | jq ".$P[$i]" | jq keys[0] -r)
m=$(cat "$cfg" | jq ".$P[$i].$p | length")
for (( j=0;j<$m;j++ )); do
d=$(cat "$cfg" | jq ".$P[$i].$p" | jq keys[$j] -r)
mkdir -p "$P/$d"
l=$(cat "$cfg" | jq ".$P[$i].$p" | jq ".$d | length" )
for (( k=0;k<$l;k++ )); do
f=$(cat "$cfg" | jq ".$P[$i].$p.$d[$k]" -r)
find . -path "./node_modules/$p/*" -name "$f" | xargs -I{} cp -fa "{}" "$P/$d/"
done
done
done
The code seems to work, yet it looks kinda strange. Can you think of a better way to apply jq for the task just described?
In this response, I'll focus on the main point - that it is possible to construct the
shell commands with just one invocation of jq. jq does not have a "system" command
for executing these commands, so the jq program given here may need to be modified, depending e.g. on security requirements.
To get the ball rolling, note that the script given in the question generates (and executes)
the following shell commands:
find . -path ./node_modules/bootstrap/* -name bootstrap.min.css | xargs -I{} cp -fa {} public/css/
find . -path ./node_modules/bootstrap/* -name bootstrap.min.js | xargs -I{} cp -fa {} public/js/
find . -path ./node_modules/jquery/* -name jquery.min.js | xargs -I{} cp -fa {} public/js/
These commands can be generated with just one invocation of jq using the following jq program:
def construct:
(.value | to_entries[] | "-name \(.value[0]) | xargs -I{} cp -fs {} public/\(.key)/") as $s
| "find . -path ./node_modules/\(.key)/* " + $s ;
.[][]
| to_entries[]
| construct
Note that in the output produced by this jq program, the ordering is different, because the script in the question uses keys, which sorts the keys alphabetically.

terminal mkdir with variable and subfolders

I have a text file "modules.txt" containing (individual module names):
dashboard
editor
images
inspector
loader
navigation
sharing
tags
toolbar
I want to create a folder structure for each module like:
dashboard/templates
editor/templates
flash/templates
images/templates
etc ...
I'm fiddling around in the area of:
cat modules.txt | xargs mkdir -p $1/templates
But this creates the first level of folders, ignoring the /templates part and giving and error:
mkdir: /templates: File exists
Which it does not.
I've tried all sort of combinations of:
cat modules.txt | xargs mkdir -p $1/{templates}
cat modules.txt | xargs mkdir -p $1{templates}
cat modules.txt | xargs mkdir -p $1/{templates}
cat modules.txt | xargs mkdir -p $1\/{templates}
(yes, pretty much guessing here)
I've also tried to add the /templates to each line in the text file, but that makes the whole thing crash.
Any ideas how to go about doing this?
Turns out, this did work when adding /templates to the text file. Must have been to tired (or stupid) when fiddling with this.
cat file_containing_folder_structure.txt | xargs mkdir -p