This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Creating a New Java Project from Head, results in a JavaApplication1 and libraries folder being created. As the creation code in the Mercurial plugin looks for a common ancestor when deciding where to place the .hg directory and so what is the parent folder of the repository, it now breaks and incorrectly puts the repository .hg under the parent of JavaApplication1 and Libraries, in my case NetBeansProjects. The question we have what is the expected behavior? Should the libraries folder be under this projects control or not? If it is meant to be under VCS control then we have a problem, what do I do when we create another New Project, is it also meant to control the Library files? I don't think we can do this. As it stands if I create multiple JavaApplications then they will all be in the same repository, under NetBeansProjects. Is this what you expected to happen or not? Some sample output: Mercurial Initialize -------------------- Initializing repository for JavaApplication26 Creating mercurial /export/home/jr140578/NetBeansProjects/.hg directory The 5 project files will be added to the repository for /export/home/jr140578/NetBeansProjects/libraries on the next commit: /export/home/jr140578/NetBeansProjects/libraries/CopyLibs/org-netbeans-modules-java-j2seproject-copylibstask.jar /export/home/jr140578/NetBeansProjects/libraries/junit_4/junit-4.1.jar /export/home/jr140578/NetBeansProjects/libraries/junit/junit-3.8.2-api.zip /export/home/jr140578/NetBeansProjects/libraries/junit/junit-3.8.2.jar /export/home/jr140578/NetBeansProjects/libraries/nblibraries.properties The 7 project files will be added to the repository for /export/home/jr140578/NetBeansProjects/JavaApplication26 on the next commit: /export/home/jr140578/NetBeansProjects/JavaApplication26/nbproject/project.properties /export/home/jr140578/NetBeansProjects/JavaApplication26/nbproject/genfiles.properties /export/home/jr140578/NetBeansProjects/JavaApplication26/build.xml /export/home/jr140578/NetBeansProjects/JavaApplication26/manifest.mf /export/home/jr140578/NetBeansProjects/JavaApplication26/nbproject/build-impl.xml /export/home/jr140578/NetBeansProjects/JavaApplication26/src/javaapplication26/Main.java /export/home/jr140578/NetBeansProjects/JavaApplication26/nbproject/project.xml INFO: Repository initialized, make sure to commit the new project files INFO: End of Initialize Mercurial Commit ---------------- init hg add project.properties hg add junit-3.8.2-api.zip hg add genfiles.properties hg add build.xml hg add build-impl.xml hg add manifest.mf hg add nblibraries.properties hg add org-netbeans-modules-java-j2seproject-copylibstask.jar hg add junit-4.1.jar hg add Main.java hg add project.xml hg add junit-3.8.2.jar Committing 12 files to repository for JavaApplication26: /export/home/jr140578/NetBeansProjects/JavaApplication26/nbproject/project.properties /export/home/jr140578/NetBeansProjects/libraries/junit/junit-3.8.2-api.zip /export/home/jr140578/NetBeansProjects/JavaApplication26/nbproject/genfiles.properties /export/home/jr140578/NetBeansProjects/JavaApplication26/build.xml /export/home/jr140578/NetBeansProjects/JavaApplication26/nbproject/build-impl.xml /export/home/jr140578/NetBeansProjects/JavaApplication26/manifest.mf /export/home/jr140578/NetBeansProjects/libraries/nblibraries.properties /export/home/jr140578/NetBeansProjects/libraries/CopyLibs/org-netbeans-modules-java-j2seproject-copylibstask.jar /export/home/jr140578/NetBeansProjects/libraries/junit_4/junit-4.1.jar /export/home/jr140578/NetBeansProjects/JavaApplication26/src/javaapplication26/Main.java /export/home/jr140578/NetBeansProjects/JavaApplication26/nbproject/project.xml /export/home/jr140578/NetBeansProjects/libraries/junit/junit-3.8.2.jar INFO: End of Commit
IMHO creating a new repository is a rare and serious activity which should not be exposed through the IDE's GUI to begin with. Certainly the IDE should never decide on a repo root on its own; if there must be an "Init" command in the GUI, the user should be prompted with a filechooser where the root should be.
"creating a new repository is a rare and serious activity which should not be exposed through the IDE's GUI to begin with" Really? If you are setting up a large scale OpenSource project then for sure it's a rare activity, but if you are just hacking away on your own pet projects and want the benefits of VCS or are working with a few others then it could be quite a common experience and I think the GUI should make it simple and easy to do. The question remains here if I create a New Java Application and put it under local Hg control, I would expect things to just work. Now with the shared libraries being created at the same level as the JavaApplication we need to figure out what we should do. Do we put up a file Chooser dialog and ask them to choose, they might rightly wonder why when we bring it up we put them at a level above the JavaApplication they are creating.
My suggestion: if the project has any generic source roots not inside the project dir, such as ../libraries, warn the user and bring up a filechooser. Otherwise assume they want to use the project dir (and maybe bring up a filechooser anyway, but that's just my opinion).
My two cents: I would question using project folder as root of repository. One VCS repository per project? That does not sound like reasonable default. Unless it is HelloWorld application which you not gonna store in VCS anyway. I would say almost always your "product" will (or should) end up implemented as multiple NetBeans projects and you wanna have all these in one VCS repository. So we should not encourage users to create one project with huge monolithic source tree. Or am I missing something.
OK - well with the libraries folder being created at the same level as the JavaApplicationX we need to address this issue. Proposal: Bring up a dialog which says something like: -------------------------------------------------------------------------------------------- This Project has source roots not inside the NetBeans project dir (refer to Output Window). (Mercurial repositories can only control code under the repository root) Common ancestor for sources. Repository root: [detected common ancestor dir] [Browse Button] If this is not what you want you may select your own repository root. [OK] [Cancel] [Help]
mercurial should be able to deal with this situation somehow. I wasn'tin favour of making it the default (../libraries) but got convinced by other people that it indeed is the best default.
Well NetBeansProjects is a scratch area for play projects. If people want to set up version control on some dir here, of course we should not prevent them, but neither should we worry too much about making it useful.
Ok - so I will drop this down to a P3, as it is working as designed and make it an enhancement to bring up a dialog when doing a Initialize so a user can choose a different root if they wish.
If the user is creating a project that will have sources outside the project dir we warn them that a common ancestor needs to be set for root and they can cancel if they do not wish this to happen.
Created attachment 57527 [details] main_work_70665_b1bc8c98e314-#127987-sources-outside-project2.patch
Patch pushed in da741f833d68.
Don't forget to define a Target Milestone when closing any issue as FIXED.