How to add second project to the repository? - repository

I have setup subversion 1.6.5 on Fedora.
I have decided to use a single repository for multiple projects. I have added one project, projA, to the repository. I will have more projects to add to the repository in future.
If I try to add next project with the command
'svn import . file:///path/to/repos' gives
svn: File already exists: filesystem '/usr/local/svn-repos/proj-test/db', transa
ction '1-1', path '/trunk'.
The new projB is being added to the trunk directory of projA.
I have read the section "Adding Projects" in
http://svnbook.red-bean.com/en/1.1/ch05s04.html
In that book, projects are added at once. But,I would like to add them one by one as new projects become ready to go. What is the proper command and/or how that can be done?
Thanks.
Banani

A repository is just a tree of files. If you wanted to have two projects in one repo (why you'd want this, I'll never understand), you would do the following:
$ mkdir repo
$ svnadmin create repo
$ cd /path/to/projectA
$ svn import -m "importing project A" . file:///path/to/repo/projectA/trunk
$ cd /path/to/projectB
$ svn import -m "importing project B" . file:///path/to/repo/projectB/trunk
go check out your project somewhere:
$ svn co file:///path/to/repo
and you should get a tree like:
repo/
repo/projectA
repo/projectA/trunk
repo/projectB
repo/projectB/trunk

Import is only used on an initial import to the repository.
If you want multiple projects in one repository then you can make a directory with directories for each project within it.
Since you have already imported you can make and add directories to your working copy for each new project you need.

Related

Importing a specific folder from a GIT Erlang repository in IntelliJ

IntelliJ IDEA 2022.2.2
Erlang plugin 0.11.1144
SDK: Erlang OTP 25, erts-13.0
Folder To be Imported: https://github.com/erlang/otp/tree/master/lib/common_test
I am able to import the complete project https://github.com/erlang/otp.git in IntelliJ. But, I am interested in a specific module common_test. I checked File->New->ProjectFromVersionControl, but did not find any option to clone a specific folder. Does IntelliJ support such cloning? Please let me know the procedure if available.
One option could be to clone the specific folder outside IntelliJ as explained in How do I clone a subdirectory only of a Git repository? & then import it using File->New->ProjectFromExistingSources in IntelliJ.
With Git, cloning a specific folder is a bit tricky. In fact, you can't clone only the folder, as you clone the entire repository.
What you can do is actually to use partial-clone in combination with sparse-checkout git features. See How do I clone a subdirectory only of a Git repository?
These options are currently not supported in IJ UI, unfortuantely

Create repository in non-empty remote folder

It's been 14 years since I last worked with svn and appearently I have forgotten everything...
I have an existing web-project, consisting of a bunch of php, html, js and other files in a directory tree on a V-Server. Now I want to take these folders under version control and create a copy on my local machine using svn. So I installed subversion according to these instructions: https://www.linuxcloudvps.com/blog/how-to-install-svn-server-on-debian-9/
Using the already-present apache2.
But now I kinda hit a roadblock. If I try svnadmin create on the existing folder, it tells me that is is not empty and does nothing really. All the questions and answers I find here and elsewhere are either
a) focussing on an already existing folder on the local machine
b) assuming more prior knowledge than I have right now aka I don't understand them.
Is there a step-by-step guide for dummies anywhere on how to do this? Or can anyone tell me in laymans terms how to do this?
I can't believe this case never comes up or that it is really very complicated.
At the risk of failing to understand your exact needs, I think you can proceed as follows. I'll use this terms:
Code: it's the unversioned directory at V-Server where you currently have the bunch of php, html, js and other files
Repository: it's the first "special" directory you need to create in order to store your Subversion history and potentially share it with others. There must be one and there can only be one.
Working copy: it's the second "special" directory you need to create in order to work with your php, html, js... files once they are versioned and it'll be linked to a given path and revision of your repository. At a given time there can be zero, one or many of them.
Your code can become a working copy or not, that's up to you, but it can never become a repository:
$ svnadmin create /path/to/code
svnadmin: E200011: Repository creation failed
svnadmin: E200011: Could not create top-level directory
svnadmin: E200011: '/path/to/code' exists and is non-empty
Your repository requires an empty folder but it can be located anywhere you like, as long as you have access to it from the machine you're going to use in your daily work. Access means it's located in your PC (thus you use the file: protocol) or it's reachable through a server you've installed and configured (svn:, http: or https:).
$ svnadmin create /path/to/repo
$ 😎
Your working copies can be created wherever you need to work with your IDE. It can be an empty directory (the usual scenario) or a non-empty one. The checkout command retrieves your files from the repo and puts them in the working copy so, at a later stage, you're able to run a commit command to submit your new and changed files to the repository. As you can figure out it isn't a good idea to create a working copy in random directories because incoming files will mix with existing files. There's however a special situation when it can make sense: when the repository location is new and is still empty. In that case you can choose between two approaches:
If you want code to become a working copy, you can check out right into in and then make an initial commit to upload all files:
$ svn checkout file://path/to/repo /path/to/code
Checked out revision 0.
$ svn add /path/to/code --force
A code/index.php
$ svn commit /path/to/code -m "Import existing codebase"
$ Adding /path/to/code/index.php
$ Transmitting file data .done
$ Committing transaction...
$ Committed revision 1.
If you don't care about code once it's stored in the repository or you want your working copy elsewhere, you can import your files from code and create a working copy in a fresh directory:
$ svn import /path/to/code file://path/to/repo -m "Import existing codebase"
Adding code/index.php
Committing transaction...
Committed revision 1.
$ svn checkout file://path/to/repo fresh
A fresh/index.php
Checked out revision 1.

Git submodule is ignored

When I try to add a submodule via
git submodule add git#domian:repo.git contact
I get the following message:
The following path is ignored by one of your .gitignore files:
contact
Use -f if you really want to add it.
Here is my .gitignore:
# Ignore everything
*
# But not these files:
!*.py
!*.md
!*.gitignore
!.gitmodules
!contact/
It is resolved by using the suggested -f option, but I am curious why the !contact/ entry in .gitignore does not alleviate the problem.
A submodule is composed of a gitlink (a special entry 160000 in the Git repository index), and a remote URL+path in the .gitmodules.
So excluding !contact/ would still ignore the gitlink "contact" (which is not a folder contact/, but a special "file")
This would work better, and allow the git submodule add to proceed:
!contact
And if any other cause would still block the git submodule add, the next Git 2.26 (Q1 2020) will provide a more helpful error message.
I don't hit that error in your particular case (I have git version 2.21.0.windows.1).
I do hit that error when trying to add a submodule outside the parent repository, though (which apparently isn't supported):
$ git submodule add https://github.com/user/repo ../repo
The following path is ignored by one of your .gitignore files:
../repo
Use -f if you really want to add it.
Best guess is it's a bug...so adding !contact/ to your .gitignore doesn't fix it because it's not actually the .gitignore causing the problem.
What git version do you have? You can download the source code for your particular version, search for the error message (e.g. here it is in v2.21), and trace through the code to figure out what actually goes wrong.

Clone multiple existing Gerrit repositories to Gitlab

we are migrating from Gerrit Code Review to GitLab in our office. I know how to clone one repository from Gerrit to GitLab. But in our office server we have around 50 or so repositories. I have tried transferring the repositories manually to GitLab's 'repositories' directory and then importing, but it only creates bare repositories. I'd like to know if there's a way to clone all the repositories in one go. Please help...
but it only creates bare repositories
That is what GitLab manages, as a Git Hosting service: bare repos that you can clone locally.
You could move those non-bare repo by:
moving only the .git of your existing repo to GitLab repo folder, where each .git is renamed after the repo it was in:
repo1/.git => /home/git/repositories/repo1.git
repo2/.git => /home/git/repositories/repo2.git
repo2/.git => /home/git/repositories/repo3.git
If you are talking about two different servers (hopefully both with the same OS), I would recommend tar cpvf repo1.git.tar /tmp/repo1.git: move in /tmp and rename first, then tar, and copy over that tar to the new server.
transform those repos into bare one:
cd /tmp/repo1.git && git config --bool core.bare true
Try the Import process of GitLab (but there seems to be a bug in progress on that: issue/pull 5005
bundle exec rake gitlab:import:repos RAILS_ENV=production
While the import process command is correct, the OP redmoses mentions in the comments:
If I just copy the repositories to /home/git/repositories, then the repositories appear in GitLab with no source files or no record of previous commits done in Gerrit.
To make this work this is what I did:
Created a new directory inside the repositories directory
Copied all the repos from Gerrit (was located in /usr/local/gerrit2/git) to the new directory.
Then just simply ran GitLab's import process GitLab then created a group called "Dev" and imported the existing repositories perfectly.
And I didn't need to convert the repositories to bare.

SVN under eclipse

I want to know how to cleanly create an svn project in eclipse.
I did it badly. Tell me what I'm doing wrong:
First, I copied the files up to the server.
I take all the code, in directory draw2
mkdir branches logs trunk
all the code is put into trunk
Create the directory with
svnadmin create /var/svn/draw2
Import it with
svn import ~/draw2 file:///var/svn/draw2 -m "initial import"
Using tortoise svn, I can check out a clean copy, it seems to be there.
But then I want to use eclipse.
installed Svnkit plugins
create a new project in eclipse, from svn. It downloads the project
where before, there was a src directory, now there is a trunk/src
zillions of errors.
Is there any clean way for me to just upload a project, as is in eclipse, and then check it out on other machines?
Thanks!
(1) Create project in Eclipse.
(2) Right click
(3) Select Team->Share Project
(4) Follow the wizard