Controlling eGit's treatment of symbolic links - eclipse

I am setting up a project that will be shared among several programmers at my organization. We are using git--to which I am a newcomer. The project directory includes symbolic links to documentation directories that should not be under version control. I want to maintain the symlinks under version control as symlinks, rather than having them dereferenced and all of the content of the symlinked directory placed under version control.
I find that the git command line tool behave the way I want: git add -A. However if I try to use the Eclipse version of git, eGit, to add all the currently unversioned files, using Team->Track on the project context menu, eGit wants to add every file in the symlinked directories. Is there a way to tell eGit that, no, these are really symlinks, and should not be dereferenced?

Our problem was discussed in this: Eclipse Community Forums Thread
It looks like currently the Linux native lstat support is not too easy to make portable. The Least Common Denominator paradigm that they have for programming Eclipse in Java make it harder to do Linux or Mac native stuff. (read: *cough* Windows doesn't support symlinks *cough*).
The good news is:
It seems possible, but they'd need to code it in a way that complies to their 'Write Once Test Everywhere' programming standards. I feel that it's important to have some native stat and lstat support on Linux when using EGit because of this problem, as well as Eclipse bug #346079.
Simply having EGit installed causes slowdowns & IDE freezes when doing a Git Refresh :-(
The bad news is:
These two bugs are stopping me from using EGit for the majority of my git commands. The user experience makes EGit unusable for me. It would be really nice to be able to use EGit within Eclipse so that Mylyn User Stories & Tasks could be tied to feature branches automatically. It would also be great to have the automatic commit message template features. This would make putting the current task & status in the commit message a breeze.
This is bugging me almost enough that I'm ready to see if it's possible to make some scripts to query Eclipse / Mylyn for the current commit message template output, and do the git commit from the commandline using this. I'm not sure how automatic per-user-story feature branch creation would work though.
Until these problems get fixed, I'm sure a lot of EGit users will not be happy :-(

We suffered from this problem cluttering up the commit screen no end, and occasionally causing someone to forget to include a file they had created.
The solution we came up with was to manually edit the .gitignore files to include the paths where the linked files would appear when the symlinks were dereferenced:
/ProjectHomeFolder/.gitignore
Since we were working in the Play Framework we also edited the following ignores:
/ProjectHomeFolder/conf/.gitignore
/ProjectHomeFolder/public/.gitignore
We simply added
/ModuleName for each of the modules that were symlinked and now egit ignores them properly, for completeness here is the full contents of my root .gitignore file, that sits in the root directory of the project:
/.project
/.classpath
/.gitignore
/eclipse
/tmp
/crud
/.git
/.settings
/modules
/conf
/betterlogs-1.0
/chronostamp-0.1
/logisimayml-1.5
/betterlogs-1.0
/sass-1.1
/deadbolt-1.4.2
/jquery-1.0
/log4play-0.5
/messages-1.1.1
/navigation-0.1
/jqueryui-1.0
/scaffold-0.1
/table-1.2
/tabularasa-0.2

Related

Why did the GitHub windows client delete all of my work?

Yesterday, I decided I wanted to upload all of my old crappy work. It is back when I was just starting programming and just wanted to show people it. I have never used git (very bad decision in my part) and created a repository. I downloaded the windows client and the egit eclipse plugin. I used the egit plugin but it just moved everything to a Oder and made it a local repository. I then used the windows client to submit a commit. It was taking a while so I left it on and went to sleep. I woke up this morning and everything was deleted except the folder names, .gitignore files and .project files from eclipse. Is there anyway I can get this old work back.
Thanks!
At the root folder of your project, run gitk from the Git Bash and you'll see your changes.
I have found a solution here: https://www.quora.com/Git-revision-control/How-do-I-retrieve-added-files-but-not-committed-from-a-reset?share=1
Basically you can retrieve the files from blobs but you have to do this one by one. I am writing a program to do so automatically now.
Is there any other easier way though?
If so, I would be glad to know.
Edit: Oh my I completely forgot about the previous versions tab on Windows. I'm just doing that.
Thanks!

How can I stop eclipse+git on windows from screwing with file permissions?

We have files that should be executable, and are happily executable in git, but then editing and committing the file from Eclipse on Windows results in the file mode being changed to remove executability.
This happens regardless of whether core.filemode is set to true or false.
Basically egit seems to be too naive for our purposes (breaking file permissions is the problem, but it also doesn't seem to support git-svn) so we're using msysgit instead - we have to manually refresh in Eclipse after switching branches etc, but that's a small enough sacrifice compared to it breaking our code.
There are recent fixes for the filemode problems post 1.2, e.g. use the nightly build.

CVS showing all files as outgoing in Eclipse

I recently switched my development workstation from Windows to Linux (Fedora64). I use Eclipse with PDT and CVS for PHP programming. I copied my entire project folder, including the .project file to my Linux system and imported it in Eclipse. It automatically detected the CVS server IP and login. However, when I sync, it shows all my files (>8000) as outgoing, and moreover the sync is always stuck at 79%. How do I fix this without checking out the entire project from CVS again? Thanks.
This might be an issue with timestamps that are now slightly out-of-sync with the meta data recorded in the hidden ./CVS folders of your working copy. Try running cvs status on your sandbox (sorry, I'm not familiar with Eclipse's CVS interface, but that's how you would do it on the command line). That should reset the supposedly modified files.
You also might get away with simply running Update. If all else fails, do a fresh Checkout.
Update: I googled a little and found some articles that can be interpreted to say that Eclipse does an implicit status when doing an "Update" or "Update Check".

A good development environment setup for Web2Py

Have been trying out Web2Py for a couple of days now and I decided it to be a keeper. But there is one thing that concerns me a lot and that might be a showstopper in the end. I need a nice development environment & setup I can trust and be productive with. Coming from the MS Visual Studio world I'm looking for something with good autocomplete / intellisense + functions for versioning and deployment.
I did some attempts to edit my code in Eclipse but it needs additional setup to run with autocomplete, and for debugging I dont know if it's possible. (Noticed there was a Django project template in Eclipse which is a bit tempting I must say.)
Wing Ide has a instruction on how to get web2py up and running and I am up to testing that one. Not free, but very cheap compared to much in the Windows world.
I also want a good versioning (hg) setup, and preferably a semi-automatic FTP-deployment-method.
What IDE do Web2Py developers use, and how do your setup look like?
A complete setup script for a project in a good IDE would be awesome! (Just like the installation is, one click to get it running 100%).
Pycharm looks good, perhaps that one can add web2py support http://youtrack.jetbrains.net/issue/PY-1648
Thanks a lot!
OS: Windows 7/Windows XP
IDE: NetBeans
Version control: TortoiseHg/NetBeans
Debugger: winpdb
Shell: IPython
Publish: WinSCP/PuTTY/TortoiseHg
Scripts
Once I create a new project in web2py I add a few scripts to my main app folder:
web2py\applications\myapp\DebugWinpdb.bat:
C:\Python25\Scripts\winpdb.bat ..\..\web2py.py -i 127.0.0.1 -p8000 -mypassword
web2py\applications\myapp\DebugShell.bat:
C:\Python25\Scripts\winpdb.bat ..\..\web2py.py -S myapp -M
web2py\applications\myapp\Shell.bat:
python ..\..\web2py.py -S myapp -M
IDE
As others have stated you need to do some extra stuff to get autocomplete/intellisense for web2py no matter what IDE you use.
For me NetBeans was a good compromise between does-everything-if-only-you-can-figure-out-how (Eclipse/PyDev) and does-the-basics-but-few-extras (PyScripter).
NetBeans Setup (Project Properties):
Python Category
Python Platform: Python 2.x (default is Jython)
Run Category
Main Module: web2py.py
Application Arguments: -i 127.0.0.1 -p 8000 -a mypassword
NetBeans Pros:
Tight Mercurial integration
Highlights which lines have been added, changed, or deleted in your source file as you edit it
Selective rollback of individual changes you've made since your last commit
One of the nicest visual diff viewers I have used
Python PEP8 style hints (fully customizable)
Name "foo" is not a valid class name according to your code style (CapitalizedWords)
Name "Bar" is not a valid function name according to your code style (lowercase_with_underscores)
Auto-format hotkey (corrects spacing around operators, etc)
Navigation within source file
semantically indexes current source file
organizes alphabetically by type (Class, method, attribute, etc)
makes even enormous style sheets manageable
NetBeans Cons:
Integrated Debugger doesn't work with web2py (that one really hurts)
Long startup time (but acceptably snappy for me once up and running)
Version Control
I use and highly recommend Mercurial for source control. As mentioned earlier, NetBeans has great support for Mercurial but there are some things I'd just rather do in TortoiseHg.
TortoiseHg Pros:
Shell overlay icons
Repository Explorer
view repos history with graphical display of branching/merging
one stop shop for Incoming, Outgoing, Push, Pull, Update, etc with button for Commit tool
Commit tool
Hunk Selection: cherry pick changes from within a file for more focused Commits
Add, Remove, Diff, Revert, Move, Remove, Forget
TortoiseHg Cons:
No easy way to drop directly into a command line
Bug that regularly prevents files from being removed during commit (waits indef for a lock to be released; running hg addremove from command line is a reliable workaround)
Publishing
I use a combination of WinSCP (for browsing), PuTTY (for terminal commands), and TortoiseHg (for push/pull of my repos) to work with my shared hosting account on Webfaction.
The first thing I do is set up public/private key encryption. If you are having trouble getting this set up between Windows and Linux, try these instructions from Andre Molnar. Short story is you need to generate your private key using ssh-keygen on Linux, copy it down to your Windows machine using WinSCP, then convert it for use with WinSCP and PuTTY.
Then add the following lines to your global mercurial.ini file:
[ui]
ssh = "C:\Program Files\TortoiseHg\TortoisePlink.exe" -ssh -2 -i "c:\path\to\your\privatekey.ppk"
Even if you have to connect to multiple servers, you need only copy your public key to each of the different servers. You'll also want to let WinSCP and PuTTY know where your private key is located, but those are fairly easy to figure out.
Try the new web2py admin interface in trunk. It has a web based mercurial interface and a google deploy interface.
In web2py you can edit applications/admin/models/0.py and set
TEXT_EDITOR = 'amy'
And you will get the web based Amy editor with autocompletion. It is not default because because it does not work with some browsers and because autocompletion is not as good as eclipse. It may work for you.
You can use web2py with Eclipse but you need a minor workaround to let Eclipse know about the web2py environment. It is explained here.
I know other users have used other IDEs with web2py, for example WinIDE and pyCharm. I suggest you ask on the web2py mailing list where people are very helpful.
I'm pretty sure that the 'one-click setup script' to do all that you are looking for does not exist (at the moment). But don't be put off - you can achieve a nice development environment to suit your needs and there are lots of choices.
Although I develop on Windows, I like the setup I have as it's more of a 'Unixy' way of thinking whereby I have a number of tools each doing a specific task. Once you get a workflow setup you can be very productive - although I realise it may look a bit confusing initially coming from a Visual Studio world.
Below I outline what I've settled on. I'm sure others will have their own recommendations. Pick the options you like best.
(There should be hyperlinks to useful software below but I don't have enough reputation to include more than 1 link...)
For developing on Windows I'm enjoying using Pyscripter. It's free, fast (compared to Aptana / Eclipse / Netbeans etc) and has some nice features (dark theme, integrated python console and code explorer to name a few).
To get code completion / intellisense to work for web2py you need to add some code to your model / controller files because of the way web2py works. There are some instructions in this discussion topic on the web2py group.
web2py has a great error ticketing system built in (see the web2py book chapter 3). For more comprehensive debugging, pydb seems to be the way to go. Just put the code below as a breakpoint:
import pydb
pydb.debugger()
and it'll take you to the debugger.
I use TortoiseHg for Mercurial integration and it works wonderfully. Combine that with winscp and you can deploy easily.
Caveats: I work in OS X, and do most of my coding in BBEdit.
That said, I've used both Wing and Komodo IDE for web2py debugging, and they've both worked quite well for me. I haven't tried NetBeans in a while now; when I did the Python support seemed a little rough around the edges. And I've never had the time or patience to come up to speed with Eclipse; it's filed in my mental file cabinet with Emacs, no doubt unjustly to Eclipse and/or Emacs.
(And I'll echo mdipierro's recommendation to try the web2py mailing list; it's really indispensable--one of web2py's strongest points.)
Have you considered using fewer tools? Both Python and web2py don't require a whole lot of code to get a lot accomplished. web2py only adds 10 or 15 new function calls (besides the HTML helpers and validators). You might find that Eclipse and other IDEs actually get in the way. Setting up new apps in web2py is simple through the admin system. Since the new app scaffolding copies the welcome app, you can customize new app setup by editing the welcome app. With Mercurial (or Git, Subversion or Bazaar) you can set up a server on your machine or with one of the public sites and either push or pull updates to your production server. Keep it simple, I say.
we are using web2py framework for all our web application needs and this is our setup :
OS - Ubuntu up-to-date
IDE - Aptana Studio 3.0 with pyDev
Version Control - git
Python 2.7
Browser for developing phase : Chrome
I've found the Wing IDE debugger to be very useful. It's a powerful debugger across the board, and also can be configured to do remote debugging, which is really important when you are running web2py on a no-GUI remote machine (e.g. at Amazon Web Services).

Emacs users are unable to commit via bazaar to launchpad

All of the emacs users on our development server are unable to do a bazaar commit to our development branch on launchpad. They receive this message:
bzr: ERROR: Cannot lock /.. /.bzr/checkout/dirstate: [Errno 13] Permission denied: u'/../.bzr/checkout/dirstate'
I've double-checked all of the permissions and everyone has their keys set up correctly. I'm using vim and have no problems.
Any other ideas?
Thanks, Jen
This error does not look like it has anything to do with Launchpad's server side.
The error means bzr is failing to acquire a filesystem lock for the "checkout" part of the tree. The "checkout" in bzr represents the checked-out source files and associated metadata. It's what makes it possible to run "bzr st", "bzr add" and similar commands.
Since you describe the problem as emacs-specific, it might be something wrong with the emacs mode you are using for driving bzr. Is that VC, or DVC?
Generally, VC does not do what you would expect, because it's designed for centralized version control systems such as RCS, SCCS, CVS and Subversion. Make sure to investigate the use DVC instead.
The way you phrase it, you suggest that all developers are working on the same branch on a shared development server. That's a pretty unusual way to use a distributed version control, you should check that the .bzr/checkout directory has the appropriate permissions. For you that would be something like rwxrwtr-x. Note the setgid bit on directory.
The best place to get such problems resolved is the #bazaar channel on irc.freenode.net. Diagnosing and solving such problems often requires a number of roundtrips, and IRC is a more appropriate medium than stackoverflow.
Look for a .lock file of some kind. Sometimes they don't get cleaned up after a crash and the resource stays locked. Maybe the Emacs plugin for bazaar created it and thats why vim doesn't care.
I'm with ddaa on this. It is almost certianly an issue with the emacs mode they are using to do their checkouts. Presumably they have no problem using the command-line interface to bzr, right?
The source code for the modes in usually found under the Emacs installation directory in either the lisp or site-lisp subdirectories. However, it is written in a special elisp language, so it is tough reading if you don't know elisp (or at least lisp in general). But if you post exactly what mode they are using, what version, and perhaps what version of emacs, there may be some folks reading who can enlighten you about known problems and whatnot.