From owner-freebsd-questions@FreeBSD.ORG Fri Jul 13 22:53:56 2007 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 8AA9A16A400 for ; Fri, 13 Jul 2007 22:53:56 +0000 (UTC) (envelope-from keramida@ceid.upatras.gr) Received: from igloo.linux.gr (igloo.linux.gr [62.1.205.36]) by mx1.freebsd.org (Postfix) with ESMTP id 0426313C481 for ; Fri, 13 Jul 2007 22:53:55 +0000 (UTC) (envelope-from keramida@ceid.upatras.gr) Received: from kobe.laptop (dialup56.ach.sch.gr [81.186.70.56]) (authenticated bits=128) by igloo.linux.gr (8.13.8/8.13.8/Debian-3) with ESMTP id l6DMrO9Z007089 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Sat, 14 Jul 2007 01:53:33 +0300 Received: from kobe.laptop (kobe.laptop [127.0.0.1]) by kobe.laptop (8.14.1/8.14.1) with ESMTP id l6DMr9GN004493 for ; Sat, 14 Jul 2007 01:53:16 +0300 (EEST) (envelope-from keramida@ceid.upatras.gr) Received: (from keramida@localhost) by kobe.laptop (8.14.1/8.14.1/Submit) id l6DMBSwg001739 for freebsd-questions@freebsd.org; Sat, 14 Jul 2007 01:11:28 +0300 (EEST) (envelope-from keramida@ceid.upatras.gr) Date: Sat, 14 Jul 2007 01:11:28 +0300 From: Giorgos Keramidas To: freebsd-questions@freebsd.org Message-ID: <20070713221128.GA1695@kobe.laptop> References: <20070712163614.GI1254@tigger.digitaltorque.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20070712163614.GI1254@tigger.digitaltorque.ca> X-Hellug-MailScanner: Found to be clean X-Hellug-MailScanner-SpamCheck: not spam, SpamAssassin (not cached, score=-3.796, required 5, autolearn=not spam, ALL_TRUSTED -1.80, AWL 0.60, BAYES_00 -2.60) X-Hellug-MailScanner-From: keramida@ceid.upatras.gr X-Spam-Status: No Subject: Merging with Mercurial (was: Re: macosx stuff seeping into the ports?) X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Jul 2007 22:53:56 -0000 On 2007-07-12 12:36, "Michael P. Soulier" wrote: > I just tried a merge with mercurial, built out of ports. > > /usr/local/bin/hgmerge: > /Developer/Applications/Utilities/FileMerge.app/Contents/MacOS/FileMerge: not found > > Umm, why the hell would I have that on FreeBSD?? The default 'hgmerge' script distributed as part of the official Mercurial tree tries FileMerge and a few other merge-tools before giving up. You can always replace the default merge-tool with one you like better, by a variety of methods: ------------------------------------------------------------------------ 1. Setting in your ~/.hgrc file the ui.merge option: [ui] merge = kdiff3 Popular choices for [ui.merge] include kdiff3, meld and I've recently started experimenting with Sun's "gpyfm" Python/GTK+ GUI merge tool. ------------------------------------------------------------------------ 2. Setting HGMERGE in the environment of the `hg' utility: $ env HGMERGE=true hg merge When you use this sort of 'merge trickery', you can do things like: $ hg up -C localhead $ env HGMERGE=true hg merge [remotehead] and then you can selectively "revert" files to their local head version, or to their remote head version: $ hg revert --no-backup -r remotehead obj/lib/libfoo.so.1 $ hg revert --no-backup -r localhead obj/bin/* This tends to a bit error-prone and doesn't really help when you _really_ want to do a 3-way merge of source code or text files. ------------------------------------------------------------------------ Most of the available merge tools tend to create a varying level of mess with binary files, like snapshots of build trees, so I'm looking at alternative ways of merging. Each time Mercurial invokes $HGMERGE or [ui.merge] there is a conflict because both the local and remote branch has modified the same file. Ideally, it should be possible to write a smarter merge wrapper script, which is written in Python to hook into Mercurial as a backend, and provide the user with more choices, like: $ export HGMERGE=smart-merge $ hg up -C localhead 0 files updated, 0 files merged, 0 files removed, 0 files unresolved $ hg merge [remotehead] Merging file obj/lib/libfoo.so.1 command: (a)ccept, (d)iff, (e)dit, (h)istory, (m)erge, (q)uit changeset: (a)ncestor, (p)arent, (c)hild, (m)erged [m]> At which point, you can run commands like: ? accept child ? acc ch ? diff parent ? h p or any sort of command which can be auto-completed to something meaningful using some sort of syntax like the one shown above. This way it would be _much_ easier to merge binary files, and given a sufficiently 'smart' HGMERGE application it could be easy to merge by pressing RET RET RET a few times, and let the defaults apply :) This may be tricky to write, and I don't trust my Python skills yet to embark on such a project, so I'm just using a local wrapper around gdiff3 and Sun's gpyfm GTK+-based merge tool (gpyfm) for now. For Mercurial workspaces which contain source code, this combination can really work wonders :-) If you need help with setting up something which supersedes the default 'hgmerge' script distributed with the Mercurial port, please feel free to ask me for the merge scripts I am using locally, search for "MergeProgram" in the Mercurial wiki[*], or hop into #mercurial on Freenode IRC and chat with all the friendly folks there. [*] http://www.selenic.com/mercurial/ I hope all this helps a bit, - Giorgos