we are using Perforce for source configuration management and I have just started to hack some small stuff in Ruby on Rails. As Perforce follows the "check-out before modify" paradigm, and RoR expects to have all files writable for the various script/ stuff, do you know/use any helpers to make RoR work together with Perforce? I know I could just open all files for edit all the time, but is there something more elegant?
Thanks,
Henrik
"Check-out-before-edit" is Perforce's dominant paradigm, but not the only way to use it. Perforce has a good article on Working Disconnected, which sounds closer to your needs:
Set up your Perforce workspace with the "allwrite" option
Allow RoR to make any changes to any files it wants
Update the server's view of your workspace by marking the files you added, deleted, and modified. You can use "Reconcile offline work" in p4v, or run several shell commands suggested in the "Working Disconnected" article.
I use git for local RoR development, then git-p4 to synchronize with the Perforce server. My workarea files stay writable, I get all the benefits of git, and I stay in sync with others on my team who use Perforce.
Not sure what you are asking: do want do check-out your files before you compile in your IDE -or- do you want to do perforce actions in a RoR application?
If it is the latter, try P4Ruby:
http://public.perforce.com/guest/tony_smith/perforce/API/Ruby/main/doc/
The other requires IDE support, which is possible, however I cannot advise further unless you say which one you are using (Visual Studio, CodeGear, Notepad?).
HTH,
Related
At work we are using TFS Team Foundation Version Control (TFVC) and the workspace is a server workspace (very large codebase). The limitations of our setup are that files checked out are locked for edit by other people. Also there is a culture of not committing until work is complete etc as many change-sets complicate merging later.
I am in no position to change the global rules or culture. I would like to locally setup a mercurial (hg) repo on my local machine. The idea is that I can work on my local copy make as many checkins to hg. When I am done I would like to bundle my changes into one changeset and send it off to the TFS location (also on my local machine). Then immediately checkin the changes to TFS server.
That way to the outside world I appear to checkout and then immediately checkin all of my code, only briefly locking the files changed. But locally in hg I get the full ability to make small checkins and work without worrying about locking files out for edit.
Somehow chain two version control systems, giving me the flexibility of HG locally, but continue using the global TFVC for final checkins.
Any ideas on how this could be achieved?
You can use git-tf and the hg-git. This was an intentional design decision when we built git-tf that this was a supported scenario.
That said... this seems a bit... icky.
You may want to write a few shell scripts to make this workflow a little bit easier.
But even with that, it's hard to imagine troubleshooting this when something inevitably goes wrong.
TFS doesn't have Mercurial support, but apparently does have Git support.
You can use the hg-git plugin to access TFS this way.
More details about the lack of support:
https://hglabhq.com/blog/2014/1/17/mercurial-support-in-tfs-declined
https://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/3607357-add-mercurial-support-to-team-foundation-server
I'm working on an ASP.NET MVC website. Each time I do important modifications, I copy/paste the entire folder of my solution and rename it something like MySolution v1.1, next time MySolution v1.2, ... In that way, I can always step back easily and keep versions. But I always have problems with the database.
Example:
I work on MySolution v1.1 with the database in the App_Data named MyDB1.mdf
I copy/paste previous version in MySolution v1.2 folder
I cannot run successfully this newly created solution because Visual Studio will try to recreate the database named MyDB1.mdf but this one already exist (in the previous folder).
I had to change database name in the connectionstring of the web.config file and clean the App_Data folder.
This is not a good way of doing things. Furthermore, I lost my data in my DB because I delete it each time.
Does someone can give me advices for versioning my different solutions?
I hope I was clear.
Thanks in advance.
I'd suggest using a revision control system, such as Subversion or Mercurial (using TortoiseHG). This way, you can just revert to a previous version of your code if you don't like the changes you made.
I encourage you to get familar with source control. This is really important and every developer should know about it.
Here some source control systems:
Subversion
GIT
Mercurial
There are other version control systems as well. Personally I prefer Mercurial.
Hope this helps!
Use version control.
If you are working in VS you can use TFS. It has good integration into it and easy to learn (free TFS for open source projects can be found on www.codeplex.com).
Also you can use GIT (www.github.com), TortoiseSVN, etc.
Also you can do versioning for Database. In this case you can store database schema in Database project or create change scripts for database.
OK, I've been convinced that SVN is the way to go in a previous posting, but I haven't yet seen the epiphany. I'm not sure how I would set SubVersion up for my development environment.
Here's my current setup. I'm not keen to mess with it and it would be really nice if subversion could sit alongside it:
Work:
N:\Projects
N:\Projects\Lib
N:\Projects\App1
N:\Projects\App1\Help
N:\Projects\App1\Images
N:\Projects\App2
..etc
N: is on a separate server in the building.
There are several other development machines with the tools installed locally, but all development takes place referencing the files on the server - i.e. no source code is kept on the workstations.
Home
Laptop with same development toolset, and the sources in c:\Projects\App1.. etc, i.e. a mirror of the setup on n:\Projects at work.
The sources between N:\Projects and C:\Project are currently kept aligned with a custom app in conjunction with DropBox. File exclusions make sure that non-source files don't get sync'ed
I want to run SubVersion with this setup.
Where do I put the Repository?
Assuming I can have the repository in
a mutually accessible place, will SVN
remove the current need to sync
between work and home?
In order to embrace Subversion, you will replace your shared source directory with a Subversion repository that lives on the server. Each developer workstation will check out a copy of the whole source code locally (however, this could be a private area on a network server if you like).
You could retain your N:\Projects tree as a read-only copy of the daily build, or whatever. But one of the goals of Subversion is to mediate between two people editing the same file at roughly the same time. This is not compatible with a shared directory containing writable source code. Also, having multiple developers "share" the same Subversion working directory in some way is doomed to failure.
Why not create an internet accessible (free) trial Subversion account, and play around a bit, to get yourself familiar, before you move your entire source code tree into it. Just so you don't delete everything you own, by accident. Maybe start with one dummy project. Host something on the internet. Without even paying a cent, you could use this site:
http://www.projectlocker.com/
Then you can set up your very own starter subversion server. You can create a brand new Delphi application (file -> new delphi application), and add a button, and double click that button, and write a message box thingy, or whatever it is you like to do in demo apps. Now create a subversion repository (perhaps they call them projects, up on project locker), and add the folders you saved this project into, to that repository.
Now you can play with (a) tortoise SVN, (b) the SVN integration build into Rad Studio XE, if you have Rad Studio XE, and (c) the version control plugins that come in the JCL, if you don't have Rad Studio XE.
Also, may I suggest that if you want to have any hope of knowing what you're doing you learn how to add and commit, and update, from the command line. It's really not that hard. And it will pay off later.
Knowing you can type svn co http://reposite.something.com/svn/myproject to check out a project to your disk, is very handy. Sometimes, I think GUIs are training wheels for your brain. You cripple yourself if you don't learn command lines.
A benefit to a hosted subversion service like the one I showed above, is that you have an offsite backup. Of course, such hosting is always free even for large projects, if you are writing something open source. Then you can host on sourceforge. Otherwise, you're going to (a) need to use your own internet accessible host or (b) pay for hosting, otherwise you're not going to be able to easily access your repository at home, and at work.
Personally, if it was my own business, or my professional job to write software, I would host my own subversion server, and it would be private (LAN) only, and I would use a VPN to access it from home.
1: You definitely want a repository accessible from both locations. Either that, you you will need to use a distributed versioning system, like Mercurial or Git
2: Yes, there will be no more need for your custom sync app. This is exactly the job for your versioning system. Syncing manually in addition to using SVN is not necessary and would even create lots of conflicts.
Your shared directory should be removed and a copy of the code present on each machine that is a working copy of the SVN repository.
Use your server with the files to place the SVN server on it or any server that all including your home computer have access to.
Commit / Update every day, multiple time a day and manage merges if needed .
For the home access the simplest is to either get a dedicated server on the net or redirect the correct port on your router (but you will obviously need some access control in place) so that your repository is accessible from outside. If needed you could limit access from your home IP or from a list of IPs with a good router.
The other solution as other said is another kind of version system called "distributed" where every commit is done locally in your own repository on your own PC and this repository is merged on the "main" repository to share code and the change of other members of the team are pulled back in your local repository (You don't need any "main" repository technically on a DVCS but for a company that's what you will have).
See Git or Mercurial for good DVCS (Git syntax sucks but it's the most widely used system and technically the best one).
Put the repository in the safest place. That usually means a good redundant server (disks, etc.), in a controlled server room, and one which is properly backed up. When you switch to a VCS, source code to work on is typically in local machines sandboxes, because each developer must have its own. Then changes are get and sent to/from the server. Be aware that some tools may have issue is on a remote directory, because of the way for example the SMB protocol works - check they are supported explicitly if you need to use them. Unless you have paramount security needs, IMHO working in local sanboxes is faster and easier.
If you can access the SVN server from home (i.e. via a VPN), it will be not different than working from the office. You will "sync" (update/commit) your laptop sandbox the same way, you don't need a local server and repository. If you need a local server (reason could be you can't access the central repository from outside, need to work disconnected yet version files, etc.) there could be ways to replicate across SVN servers, but at that point maybe a distributed VCS should work better in such scenario.
I would like to hear the best practices or know how people perform the following task in TFS 2008.
I am intending on using TFS for building and storing web applications projects. Sometimes these projects can contain 100's of files (*.cs, *.acsx etc)
During the lifetime of the website, a small bug will get raised resulting in say a stylesheet change, and a change to default.aspx.cs for example.
On checking in these changes to TFS, and automated build would be triggered (great!), however for deploying the changes to the target production machine, I only need to deploy for example:
style.css
default.asx
MyWebApplications.dll
So my question is, can MSBuild be customized to generate a "code pack" of only the files which require deploying to the production server based on the changeset which cause the re-build?
You are probably going to have a hard time getting MSBuild itself to do this, but the ideal tool to use in your situation is the Web Deployment Tool, aka MSDeploy. With this tool you can tell it to deploy the changes to the target website. It will determine only the changed files and then just deploy those. Also you can perform customization to the deployment and a whole bunch of other stuff. It's a really great tool.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 5 years ago.
Improve this question
I desperately need source control to manage projects between more than one developer.
A long time ago I used Visual Source Safe and it worked quite well.
What free substitutes can be recommended? I have the following basic requirements:
I need to host the repository on my own server.
I do not want extra clutter within my source files, like CVS does.
I need proper check in / check out, so that nobody can change a module until I've checked it back in.
I don't want / need source code merging / branching.
We use Delphi for web development, so many HTML files, images, SQL files, etc.
Any recommendations?
Git or Mercurial.
both are distributed and fast (each repository can act as 'server')
no extra clutter just one .git or .hg directory
you can pull changes from trusted or verified sources
I'll always recommend subversion with Visual SVN for server software and Tortoise SVN for the clients. You can exclusively check out files, so that nobody else can edit them, although that's not the default behavior. The only "clutter" it adds is a hidden .svn folder in every directory that is under version control.
If you insist on zero-clutter, and also free, you have limited choices. If you are open source, you can have a free copy of perforce. No clutter. SVN has clutter like CVS: a .something directory in each directory. git and hg just have one directory of clutter per clone.
If you absolutely insist on a checkout model, you have to give something up. P4 will do it, but none of the others will very well. Most people are more concerned these days with allowing disconnected operation than with a concept of locking. even svn lock only prevents checkin, not starting to modify.
There are other more obscure systems out there (e.g. arch) that you might look into.
I discourage the checkout/checkin approach. A decent version control system should be able to merge changes. This provides you with plenty of choices: CVS, SVN and Git.
As for "clutter" in your source files: I don't consider repository directories (e.g. .svn or .git) clutter, as this allows you to copy the repository structure.
Nevertheless, in SVN (not sure about Git) you can lock/unlock a file, basically mimicking the VSS checkout/checkin.
You should read a bit and learn a bit before you consign yourself and your fellow developers to living in the dark-ages of version control.
Visual Source Safe and the locking model of version control are dead. Most people have moved on. Those that have not are usually afraid of (or loathe) the idea of branching, and merging. Once they see that branching and merging can be easier, and more effective, then they can move onwards and upwards into a new world of version control options.
Ask yourself a few of these questions:
Would I like to separate the act of creating a new feature from the act of inflicting it on other developers, and on the final product (my live website)? If so, then I need branches. One branch = No effective version control.
Have I asked the other developers who will be working with me, what practices they find effective in multi-developer projects, and do they agree with me that locks are the way to go, or am I unilaterally enforcing my way of working with them? (You can have foo.pas for today, but try to get it checked in by 3 pm because I need to make a change to method bar inside foo.pas, later today.)
If I state that I want to make sure developers "avoid using old versions" do I have reasons for that other than that I hate or fear merging? Can we not think of any ways to prevent "using old versions"? Also, can we not think of any reasons when using old versions might be exactly what you have to do? If you used a non-locking tool like Subversion, why not say "please update before you commit". Then you will never have to merge, but if someone wishes to work with a non-changing version of the sources while developing the feature and then wishes to do the merging themselves, and you never have to merge yourself, you could insist that your work be done with locking (using subversion) but allow others the freedom to use a workflow that solves their problems, instead of yours.
Suppose (as you said in comments above) someone is removing something that you are in the act of creating. Wouldn't it be nice to see a complete list of his changes and say "I would like those changes gone, without removing other changes made by other people". This is known as working with "changesets" and is a key feature of DVCS like Mercurial (hg) and Git. In fact, the ability to prevent other people from modifying YOUR local repository willy-nilly, but rather making changes, which you can then review, and either accept or not accept will always be better at creating coherence on your (master) copy of the repository than any localized, centralized locking model can ever be.
W
You might like to investigate Team Coherence (http://www.teamcoherence.com). It doesn't create special folders and has a Delphi bent to it. For example, it groups .pas and .dfm files together by default. Help is excellent. It's also now free for a single license. I've been using it for years after previously using CVS and FreeVCS.
SourceGear's Vault is free for 1 user, and it gives you checkin/checkout plus merge-style operations. It also works totally clutter-free. I have been using it for some time and it works wonders. Transition from SourceSafe is especially easy, and integration with IDEs such as Visual Studio or Eclipse is very good.
Hmm, define "clutter" - to my mind a hidden directory per folder isn't clutter, frankly it hasn't been an issue at all (for reference, 7 years of first CVS then Subversion and prior to that VSS and something distributed the name of which eludes me).
Subversion is excellent and installation is almost trivial with VisualSVN server and use is straightforward with Tortoise as a client. Locking of files is an option, not a good one in the general instance but its there for binary files if you need it. This is probably the closest match to your criteria and I like it. A lot.
For personal use I'm playing with Mercurial - but not done enough to say more than that it works (and of course like most DVCS it fails your "lock" criteria). DVCS is different and has some issues.
If you have money, Vault (http://www.sourcegear.com) is worth a look - especially if you used and liked VSS since it started out as a "better" VSS though it has evolved somewhat. Worth visiting sourcegear just to read Erik Sink's thoughts on version control.
As for the rest, whilst I'm sympathetic to a wish not to (have to) merge stuff, writing off tagging and branching is pretty much the same as saying "I don't need version control" - it turns out not to be the case.
No one is recommending Bazaar, so here I am, I use it in my everyday work with Delphi projects.
It has a diff viewer that rocks, and that, for me at least, makes the difference with the other svn-like repositories.
I haven't used it for many years but I believe Jedi VCS meets all your criteria with the added bonus that it's written in Delphi and has some built-in smarts when it comes to handling dfm files.
We are using Fossil for source code managment of our Delphi programs.
It's very easy to use (if you like the KISS command line approach), and there is an internal web-based interface.
There is no installation needed, since it's only one executable to run. It's perfectly cross-platform: you can have your own repository on your Windows machine, then clone/synchronize it into any other server, running on Windows or Linux.
You can see our repository of Open Source Delphi programs hosted by Fossil on our web site. For internal work, I've found out that Fossil uses little bandwidth (much less than CVS or SVN), and is able to synchronize huge projects in a blitz, even via an ADSL or a 3G connection.
Here are some unique features, included in Fossil (with no third-party component to setup):
Bug Tracking And Wiki
Web Interface
Autosync
Self-Contained
Simple Networking - Fossil uses plain old HTTP
CGI Enabled - No server is required to use fossil.
Robust & Reliable
I would recommend Plastic SCM: http://www.plasticscm.com/
the best (?) merging and branching support!
but you can also use single branch + exclusive checkout (aka lock)
very nice and handy GUI
free up to 15 users
very good support (within a day, mostly within an hour!)
very modern, automatic merging and branching, distributed, etc
Delphi plugin available: http://code.google.com/p/plastic4delphi/