Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Opening existing project from source control

I've been pushing my source to a Mercurial repository. Today I needed to delete my local copy and re-clone. I did this by simply moving my local copy somewhere else (just in case) and typing "hg clone url".

This part has worked just fine.

However, when I try to pull the newly cloned local copy into Eclipse, I get the following error:

/Users/Andrew/Dev/Workspace/Android/MyProject overlaps the location of another project: 'MyProject' 

My guess is that I have been committing some meta file or something that I shouldn't have. Does anyone have any ideas? Here is my .hgignore:

syntax: regexp \.DS_Store .swo .swp .metadata/ /bin/ 

Note: Looks like my hgignore is not blocking the gen folder. Could this be part of the problem?

like image 463
Andrew Avatar asked Oct 29 '10 17:10

Andrew


People also ask

How do I add a project to Source Control?

On the Project tab, in the Source Control section, click Use Source Control. In the Source control Information dialog box, click Add Project to Source Control. In the Add to Source Control dialog box, in the Source control tool list, select Git to use the Git source control tool provided by the project.

How can you add your existing Visual Studio project to version control?

Here is how to do it in Visual Studio 2015. Open the project and go to Tools >> Options >> "Source Control" tab and select "Git" as your source control. Go to File Menu and select "Add to source control".

How do I open a cloned project in Visual Studio?

Open Visual Studio. On the start window, select Clone a repository. In the Browse a repository section, select Azure DevOps. Follow the prompts to clone an Azure DevOps repo that includes the files you're looking for, and then open your project.


2 Answers

There is a bug in Eclipse what won't let you create an Android project from existing sources:

http://code.google.com/p/android/issues/detail?id=8431

You have to move MyProject to a folder that doesn't have any other projects in its sub-directories. You can then make a new project from existing source with MyProject. Remove the new project from the workspace without deleting the contents on disk and move it back to your Android folder. Now do an Import -> General -> Existing Project into Workspace, and MyProject should be available to import.

This is the only way I've been able to do it.

like image 161
Joseph Avatar answered Sep 22 '22 07:09

Joseph


Ok, I'll try to sum it up, after I faced similar problems and wasted some time:

Eclipse Juno /4.2 SR1 (however I think it is a general misunderstanding of how eclipse imports projects)

  1. If you want your new project "connected" to git/mercurial, you'll have to clone and import via "Import/Git/Import from Git"
  2. It will fail if your "workspace dir" equals the "local destination dir". A git clone via egit MUST NOT be placed! in the "eclipse workspace dir"!

The project import will fail because the projectname in the cloned ".project file" already exists in the eclipse workspace dir when the import occurs.

like image 32
M. P. Avatar answered Sep 24 '22 07:09

M. P.