12/28/2023 0 Comments Check for modifications tortoisehgSince each copy is a complete isolated repository in and of itself, this minimizes risk. It’s a good idea to make a copy of your repository before trying anything new. And if you ever find yourself in a situation where you’re not quite sure how to proceed, always reviewįirst and experiment. ![]() The important thing to understand is how to go through the steps detailed above in order to fix problems introduced in our code. If all this sounds a little confusing, don’t worry, it all becomes very natural with time and experience. Then, we merged the two together for the final committed changeset (5:d56d0cadaa51), hence that one has two parents listed. Notice how the second change listed (changeset 4:681119c99a77) lists the “parent” as not the one directly before it? This is because we essentially went back in time and created a new line of changes by fixing the bug. Now let’s learn how to make modifications to a file, see the differences between what we’ve committed, and finally commit our changes back to the repository.įirst, let’s make some changes to the file. Here you can see the complete history of the repository, including the files changed in each revision and (as we’ll later see) the differences between them. We can also right click in the directory and choose “Hg Workbench”: That little green “check” tells us the file is unchanged since its last commit. If we’d rather see this in the graphical interface (and even a hard core command line guy like me does admit this is a case where a graphical interface is pretty nice), we can look in the folder in Windows Explorer, where we’ll see this. the file has not changed since its last committed state) the “log” command shows us the history of changes committed to the repository. The “status -A” command shows us all files in the working directory and their status (the “C” means “clean”, I.e. If it’s not there, then simply create an empty file with that name and open it in your favorite text editor. Navigate to your user profile directory (powershell shortcut: “cd $env:userprofile”) and look for a file called “mercurial.ini”. There’s a few settings that we’ll want to configure at the user level, so we’ll start there. Mercurial stores its settings at three levels: computer wide, the current user, and the current repository. Next, we’ll want to change a few settings. This command initializes the repository, and if it works you’ll see a folder called “.hg” in your directory. To create a new repository, simply open a command prompt, navigate to the folder where you want the repository created, and type “hg init”. Remember, each and every user has their own complete copy of the repository kept locally, including all history. Once the installation finishes we can go on to creating our first repository.īefore we go on, it bears repeating that the concept of a “repository” is very different with a distributed version control system than with more tradition server-centric models. When running the installation package, I recommend leaving the default options selected. As we’ll see, viewing the differences between files is a huge part of using version control. ![]() I’d also recommend that you download and install WinMerge, which at least in my opinion is the best visual comparison tool available. I do this for two reasons: 1) it’s an easy way to grab everything you need in one shot, 2) there are still times when I find a GUI nice, such as looking at revision history. Yes, I know I just said I love the command line, and yet I’m advocating downloading a GUI tool. I find the best way to get this is to go and grab TortoiseHG, an excellent variation on the popular TortoiseSVN Subversion client. Note: I’m very much a command line guy, so I will tend to give examples using that as a method when possible.įirst we need to download the Mercurial tools. Now that we have some ideas for things to actually put in version control, how do we actually go about getting it setup? The steps are not difficult, so we’ll go through them here one at a time. In this article, I’m going to go a step further and actually walk you through setting up your first repository (locally for now, we’ll go into setting up a remote one later), making your first commit, and making (and viewing) changes to your newly tracked files. We also gave three examples of instances where source control can come in handy (though to be honest they were picked from a much longer list). In my previous article, we went over the reasons why DBAs should use version control, as well as the benefits of Mercurial as a specific choice.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |