{"id":2087,"date":"2010-11-14T04:54:23","date_gmt":"2010-11-14T09:54:23","guid":{"rendered":"http:\/\/www.gubatron.com\/blog\/?p=2087"},"modified":"2010-11-14T04:54:23","modified_gmt":"2010-11-14T09:54:23","slug":"mercurial-for-subversion-expats-merging-remote-changes-abort-push-creates-new-remote-heads","status":"publish","type":"post","link":"https:\/\/www.gubatron.com\/blog\/mercurial-for-subversion-expats-merging-remote-changes-abort-push-creates-new-remote-heads\/","title":{"rendered":"Mercurial for Subversion Expats: Merging remote changes. &#8220;abort: push creates new remote heads!&#8221;"},"content":{"rendered":"<p><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/farm5.static.flickr.com\/4090\/5172698880_71f475cda8.jpg?w=640\"\/><br \/>\nCommit anywhere\/anytime with Mercurial<\/p>\n<p>So you have been using subversion for the past few years and now your team has decided to move on to Mercurial for all the benefits. Two or more people are working on the same branch and they&#8217;re pushing code to the main copy of the repository before you&#8217;re done with your changes.<\/p>\n<p>In the Subversion world, if you tried to commit in this same situation you&#8217;d get an error saying that your repository checkout is not up to date, so you&#8217;d fix this by doing:<\/p>\n<p>[bash]<br \/>\n$ svn up #gets the latest changes from the repo and it tries to merge all remote changes<br \/>\n$ # &#8230; solve any conflicts if they arise.<br \/>\n$ svn ci -m &quot;my commit message&quot; #push your latest changes to the main repo.<br \/>\n[\/bash]<\/p>\n<p>In Mercurial it&#8217;s a little bit longer<\/p>\n<p>[bash]<br \/>\n$ hg ci -m &quot;my local changes&quot;<br \/>\n$ hg pull #this brings the latest version of the repo, but doesn&#8217;t change the state of your files.<br \/>\n$ hg merge #when you&#8217;re ready, you merge the changes<br \/>\n[\/bash]<\/p>\n<p><strong>If at this point you try to push<\/strong>, you will get the following error<br \/>\n[bash]<br \/>\n$ hg push<br \/>\npushing to https:\/\/user@server.com\/company\/project<br \/>\nsearching for changes<br \/>\nabort: push creates new remote heads!<br \/>\n(did you forget to merge? use push -f to force)<br \/>\n[\/bash]<\/p>\n<p>first, ignore the &#8220;push -f to force&#8221;, they should remove that message and put something like<br \/>\n[bash]<br \/>\n(did you forget to merge and commit?)<br \/>\n[\/bash]<\/p>\n<p>After a lot of thinking I was doing something wrong with the merge, I realized that before pushing you have to commit your merge locally as well, makes sense, so the whole sequence should be like this instead:<\/p>\n<p>[bash]<br \/>\n$ hg ci -m &quot;my local changes&quot; #same as &#8216;hg commit&#8217;<br \/>\n$ hg pull #this brings the latest version of the repo, but doesn&#8217;t change the state of your files.<br \/>\n$ hg merge #when you&#8217;re ready, you merge the changes<br \/>\n$ hg ci -m &quot;merging latest changes from repository&quot;<br \/>\n$ hg push<br \/>\npushing to https:\/\/user@server.com\/company\/project<br \/>\nsearching for changes<br \/>\nhttp authorization required<br \/>\nrealm: Bitbucket.org HTTP<br \/>\nuser: gubatron<br \/>\npassword:<br \/>\nadding changesets<br \/>\nadding manifests<br \/>\nadding file changes<br \/>\nadded 2 changesets with 1 changes to 1 files<br \/>\nbb\/acl: gubatron is allowed. accepted payload.<br \/>\n[\/bash]<\/p>\n<p>So, yes, its a little more work to merge and commit, but remember that you&#8217;re working now on a distributed fashion and you have to think a little bit differently, you gotta merge locally, fix any conflicts if they arise, commit the changes and push them. In exchange you don&#8217;t get to deal with lots of .svn folders, no single point of failure (one remote repo that could go down and leave all developers without version control until it&#8217;s back up), and super easy branching on a single folder, no need to checkout branches and be writing down revision numbers.<\/p>\n<p>Just remember that pulls don&#8217;t change your local changes unless you explicitly ask to do so by invoking <strong>hg merge; hg commit<\/strong>, which would be the equivalent (at least I see it like this) to <strong>svn up<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Commit anywhere\/anytime with Mercurial So you have been using subversion for the past few years and now your team has decided to move on to Mercurial for all the benefits. Two or more people are working on the same branch and they&#8217;re pushing code to the main copy of the repository before you&#8217;re done with [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[15],"tags":[],"class_list":["post-2087","post","type-post","status-publish","format-standard","hentry","category-code"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p5Unzf-xF","jetpack-related-posts":[{"id":2068,"url":"https:\/\/www.gubatron.com\/blog\/bitbucket-or-github\/","url_meta":{"origin":2087,"position":0},"title":"Bitbucket or Github?","author":"gubatron","date":"September 28, 2010","format":false,"excerpt":"This week we have to make a final choice of what technology will be used to replace our somewhat big subversion repository (2 Gigs). Huge imports are beginning to be a pain and we're tired of the .svn folders and not being able to commit if the central server is\u2026","rel":"","context":"In &quot;Geeklife&quot;","block_context":{"text":"Geeklife","link":"https:\/\/www.gubatron.com\/blog\/category\/geeklife\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":3150,"url":"https:\/\/www.gubatron.com\/blog\/how-to-add-an-existing-git-repository-to-github\/","url_meta":{"origin":2087,"position":1},"title":"How to add an existing GIT repository to github.","author":"gubatron","date":"August 31, 2013","format":false,"excerpt":"Most of the times, it makes more sense to start working on something that slowly transforms into the beginning of a project that deserves to be on github. This post is about creating a local repository and putting it on github. 1. First we must convert the main local folder\u2026","rel":"","context":"In &quot;Code&quot;","block_context":{"text":"Code","link":"https:\/\/www.gubatron.com\/blog\/category\/code\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":330,"url":"https:\/\/www.gubatron.com\/blog\/trac-svn-the-best-shit-ever-for-your-software-project\/","url_meta":{"origin":2087,"position":2},"title":"Trac + SVN : The best shit ever for your software project","author":"gubatron","date":"June 21, 2006","format":false,"excerpt":"The company I came to work for knew I had some experience with subversion (back at LimeWire and with the migration of Frostwire's CVS Repo no SourceForge.net to Subversion) so that's one of the first things I did here. Subversion is a pretty useful tool, specially if you play with\u2026","rel":"","context":"In &quot;Code&quot;","block_context":{"text":"Code","link":"https:\/\/www.gubatron.com\/blog\/category\/code\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":2751,"url":"https:\/\/www.gubatron.com\/blog\/ubuntudebian-abort-error-_ssl-c504-error14090086ssl-fixed\/","url_meta":{"origin":2087,"position":3},"title":"ubuntu\/debian abort: error: _ssl.c:504: error:14090086:SSL [FIXED]","author":"gubatron","date":"July 3, 2012","format":false,"excerpt":"Trying to clone or update a repo, and you get this error? [bash] hg pull -u abort: error: _ssl.c:504: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed [\/bash] Quick fix, go to .hgrc and put this on your [web] section [bash] [web] cacerts= [\/bash] Fixed, remember to leave a tip if you wasted hours\u2026","rel":"","context":"In &quot;Code&quot;","block_context":{"text":"Code","link":"https:\/\/www.gubatron.com\/blog\/category\/code\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":542,"url":"https:\/\/www.gubatron.com\/blog\/how-to-update-the-location-of-your-subversion-repo-without-checking-out-again-everything\/","url_meta":{"origin":2087,"position":4},"title":"How to update the location of your subversion Repo without checking out again everything","author":"gubatron","date":"July 10, 2007","format":false,"excerpt":"So you checked out code from a place, and whoever runs your subversion server decided to change the URL, or decided to switch from http:\/\/ to https:\/\/ or to svn+ssh:\/\/ ... If you're a noob, you'll probably just checkout everything again. Next time this happens just use svn switch Here's\u2026","rel":"","context":"In &quot;Code&quot;","block_context":{"text":"Code","link":"https:\/\/www.gubatron.com\/blog\/category\/code\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":481,"url":"https:\/\/www.gubatron.com\/blog\/svn-cant-create-tunnel-the-system-cannot-find-the-file-specified\/","url_meta":{"origin":2087,"position":5},"title":"svn: Can&#8217;t create tunnel: The system cannot find the file specified.","author":"gubatron","date":"March 15, 2007","format":false,"excerpt":"I was trying to checkout a project from a subversion repository using Eclipse's Subversive, and I was having problems with a subversion url that starts with \"svn+ssh:\/\/\" This means all the transport has to be done using a \"ssh\" agent. Eclipse's Subclipse plugin was giving me the error: svn: Can't\u2026","rel":"","context":"In &quot;Code&quot;","block_context":{"text":"Code","link":"https:\/\/www.gubatron.com\/blog\/category\/code\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"https:\/\/www.gubatron.com\/blog\/wp-json\/wp\/v2\/posts\/2087","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.gubatron.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.gubatron.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.gubatron.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.gubatron.com\/blog\/wp-json\/wp\/v2\/comments?post=2087"}],"version-history":[{"count":0,"href":"https:\/\/www.gubatron.com\/blog\/wp-json\/wp\/v2\/posts\/2087\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.gubatron.com\/blog\/wp-json\/wp\/v2\/media?parent=2087"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.gubatron.com\/blog\/wp-json\/wp\/v2\/categories?post=2087"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.gubatron.com\/blog\/wp-json\/wp\/v2\/tags?post=2087"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}