1 / 79

Revision Control with TortoiseHg

Revision Control with TortoiseHg. Team usage. (Team use). CS2103 – Software Engineering. Prepared by: Steve Teo Contributors: Tong Huu Khiem. Sections . Setting up the remote repo on Google Code Cloning the remote repo Syncing the local repository with the remote repo

nitsa
Download Presentation

Revision Control with TortoiseHg

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Revision Control with TortoiseHg Team usage (Team use) CS2103 – Software Engineering Prepared by: Steve Teo Contributors: Tong HuuKhiem

  2. Sections • Setting up the remote repo on Google Code • Cloning the remote repo • Syncing the local repository with the remote repo • Configuring the username • Pushing changesets • Pulling changesets • Merging changesets • Resolving merge conflict • DRCS workflows

  3. Step 1 Setting up the remote repo on Google Code

  4. Setup a Google Code Repository In this guide, we shall use the excellent open source hosting site Google Code as an example. There are other Mercurial repository-hosting sites such as BitBucketathttps://bitbucket.org/, which offers free repositories with various features and restrictions. First, sign up for a new project athttp://code.google.com/hosting/ Choose Mercurial as your version control system

  5. Setup a Google Code Repository Go to Sourcetab -> Checkout Remember to note downthe repository URL Take note of your repository URL And your password (this is different from your Gmail password)

  6. Setup a Google Code Repository You need this password to push changeset to Google Code You can access all the project you have here

  7. Setup a Google Code repository Browse the code in your repository by going to Sourcetab-> Browse Files will shows up as you commit code

  8. Setup a Google Code repository View all the changes in your project by going to Sourcetab-> Changes A commit graph will shows up as you commit code

  9. Setup a Google Code repository Go to the Administertab -> Sharing and add your team members as owners or committersunder Emails of your team members go here

  10. Setup a Google Code repository You can configure it to send activity notifications to your Google group (if you set up one for your team) under Administertab-> Source Add your team’s google group email here

  11. Step 2 Cloning the remote repo

  12. Clone a repository If you already have an existing repository of the project on Google Code (set up by one of your team members), you can cloneit from the Google Code repository to your hard disk. Otherwise,skip to Step 3 Right-click on a new folder and select TortoiseHg - Clone

  13. Clone a repository Cloningallows you to duplicate the entire repository, copying all the existing contents to the destination as well as the whole revision history. Paste the Google Code repo URL here. This slide explains where to find the Google code repo URL.

  14. Step 3 Syncing the local repository with the remote repo

  15. Sync a local repository with a remote repo If you have an existing local repository, you can also configure it to sync with the repo on Google Code Click Synchronize

  16. Sync a local repository with a remote repo Add the Google Code repository URL as the default path Choose https Use “code.google.com” Use the relative URL Save Use “default” for alias

  17. Sync a local repository with a remote repo You can also configure Post-Pull behaviorfor repositories Select Post Pull Update option will make TortoiseHg automatically update your repository whenever you pull some change

  18. Step 4 Configuring the username

  19. Configure username for accountability In a team setting, you need to identify yourself when committing so that you and your teammates know what you committed Select a repository and choose Repository Settings

  20. Configure username for accountability Unser Commitgroup, enter the username & email that you want to associate your commits with Use “name <email>” here

  21. Configure username for accountability You can also set the username in the global settings. If there are no repository-specific settings specified, Mercurial will use the global settings. This affects every repository on your computer

  22. Configure username for accountability From now on, your name will show up in subsequent commits This commit username can be different from your Google Code username Commits now have the author which you have just specified

  23. Step 5 Pushing changesets

  24. Pushing changesets Push update your changes from the local repo to a remote repo pushchanges Team’s Central Repo Member A’s Local Repo • A revisionis the set of changes whenever a push is performed. Each revision is given a number. A revisionis also known as a changeset. In this tutorial, we will use both terms interchangeably. • A revision contains other important information such as the author of the changes and the summary of each change. • Each successful commit will result in a new revision. • Each revision will definitely have one or more revision for its parent except for the first revision, which will have zero.

  25. Push changesets After making some commits to our local repository, we are ready to push all of them into our Central Repository for the first time. Right click on your local repo and choose Hg Workbench

  26. Push changesets In Hg Workbench, we will first previewthe commits that are to be pushed. Click here to preview which changes will be going to the repo Click Detect outgoing changes. This will compare the local and remote repository, finding changes to be pushed

  27. Push changesets TortoiseHg will find all the changes that need to be pushed Click Push to upload these to Google Code These are the changes that is going to be pushed

  28. Push changesets Then you will need to authenticate TortoiseHg to reach your Google code repository Enter your Google code username

  29. Push changesets And your Google code password, as well. This is not your Google password. This slide explains where to get this password. Enter your Google Code password

  30. Push changesets If the commits are pushed successfully, there will be no errors. You can look at the output logfor more info in any case. Success 

  31. Push changesets You can also do a quick verification of the success of your commits by detecting changes for pushing again This directly push changes, without checking. Not recommended for now Click here Your commit was pushed

  32. Push changesets Go to your Google code repository, check the Sourcetab-> Changes You should see that your commits were pushed successfully here

  33. Push changesets If you find it a chore to enter your login details every time you push changes or pull from a private repository which you have pull access from, you can store your login detailsusing TortoiseHg. Click “Synchronize” to open the sync panel at the bottom Click on the lock to openthe security panel Key in your Google account details

  34. Step 6 Pulling changesets

  35. Update/Merge Pulling changes only retrieves changes from the remote repository into the local repository. However, the working copy is not updated in a Pull operation. You need to update the working copy to the latest version by using the Updatecommand. If there are multiple heads (i.e. same file modified by multiple persons), you need to use the merge command instead. pullchanges Team’s Central Repo Member A’s Local Repo Member A’s Working Copy update Update changes

  36. Pulling and pushing (Diagram) In the above model, Member A commits some changes and pushes them to the Central Repository.Member A then informs the team to pull his changes off the Central Repository. Member B decides to do so and merges the changes from the Central Repository into his own repository.If any other member wishes to have the latest stable code, all they have to do is to pull off the Central Repository. Member B’s Local Repo Member B Team’s CentralRepo 4. pulland merge 3. Tells him to pull Member A’s Local Repo Member A 2. pushchanges 1. makes some changes and commit

  37. Pull & update changes Let’s say Greg have pushed his code. Now his friend, Holly decides to pull the changes into her currently empty local repository. Again, open Hg Workbench

  38. Pull & update changes In Hg Workbench, you can check for new changes from repository Check for changes from Google Code

  39. Pull & update changes When new changes are detected, you can accept and download them Click to download changes below

  40. Pull & update changes The changes have been pulled into the local repository. However, we still need to update the working copy to the latest changes. This means there are changes that is more up-to-date (2 and 3). You will need to update

  41. Pull & update changes You can update in Hg Workbench or right-click on the repository and use the popup menu Click Update to openthe update dialog

  42. Pull & update changes Use the default option to update to the latest changes

  43. Pull & update changes Here’s the view after the update.

  44. Pull & Update changes • Finding it so troublesome to pull and then update? You can configure TortoiseHg to update for you by simply configuring the Post-Pull behavioras listed in Step 3: Sync a local repository with a remote repo • Summary: • Pullingonly pulls the changesets into the local repository. • You still need to updatethe working copywith the new changesets. • Keep repeating this to yourself: Pull and Update

  45. Step 7 Merging changesets

  46. Merge changesets • You may encounter this common scenarioGreg pushed his code to the repository. Then Holly & Rowley pulled and updated Greg’s code. Rowley then made some changes, committed and pushed them. Meanwhile, Holly also made her own changes and was about to push the code. • This can be summarized in the following timeline

  47. Merge changeset Team Repository (Google Code) Pushed Greg Commit new code Pulled & Updated Pushed Rowley Try to push Pulled & Updated Commit new code Holly time

  48. Merge changesets In this situation, Hollycan’t push. She must merge his changes with Rowley’s This is how Google Code look like after Rowley has pushed his code

  49. Merge changesets Here, Holly check her code and detected one changesetthat needs to be pushed

  50. Merge changesets When she push, however, there was an error. This is because she needs to pull Rowley’s code first

More Related