<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Raphaël Slinckx &#187; script</title>
	<atom:link href="http://raphael.slinckx.net/blog/tag/script/feed" rel="self" type="application/rss+xml" />
	<link>http://raphael.slinckx.net/blog</link>
	<description>a.k.a kikidonk — Scabreusement Hype</description>
	<lastBuildDate>Tue, 22 Apr 2008 12:35:11 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>git commit / darcs record</title>
		<link>http://raphael.slinckx.net/blog/2007-11-03/git-commit-darcs-record</link>
		<comments>http://raphael.slinckx.net/blog/2007-11-03/git-commit-darcs-record#comments</comments>
		<pubDate>Sat, 03 Nov 2007 16:43:49 +0000</pubDate>
		<dc:creator>Raphaël Slinckx</dc:creator>
				<category><![CDATA[Planet Gnome]]></category>
		<category><![CDATA[Planet Gnomefr]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[commit]]></category>
		<category><![CDATA[darcs]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[record]]></category>
		<category><![CDATA[script]]></category>

		<guid isPermaLink="false">http://raphael.slinckx.net/blog/2007-11-03/git-commit-darcs-record</guid>
		<description><![CDATA[I&#8217;ve been working wit git lately but I have also missed the darcs user interface. I honestly think the darcs user interface is the best I&#8217;ve ever seen, it&#8217;s such a joy to record/push/pull (when darcs doesn&#8217;t eat your cpu) I looked at git add --interactive because it had hunk-based commit, a pre-requisite for darcs [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been working wit <a href="http://git.or.cz/" title="Git Homepage">git</a> lately but I have also missed the <a href="http://darcs.net/" title="Darcs Homepage">darcs</a> user interface. I honestly think the darcs user interface is the best I&#8217;ve ever seen, it&#8217;s such a joy to record/push/pull (when darcs doesn&#8217;t eat your cpu) <img src='http://raphael.slinckx.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>I looked at <code>git add --interactive</code> because it had hunk-based commit, a pre-requisite for <code>darcs record</code>-style commit,  but it has a terrible user interface, so i just copied the concept: running a <code>git diff</code>, filtering hunks, and then outputing the filtered diff through <code>git apply --cached</code>.</p>
<p>It supports binary diffs, file additions and removal. It also asks for new files to be added even if this is not exactly how darcs behave but I always forget to add new files, so I added it. It will probably break on some extreme corner cases I haven&#8217;t been confronted to, but I gladly accept any patches <img src='http://raphael.slinckx.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Here&#8217;s a sample session of <code><a href="http://raphael.slinckx.net/files/git-darcs-record">git-darcs-record script</a></code>:</p>
<pre>
$ git-darcs-record
Add file:  newfile.txt
Shall I add this file? (1/1) [Ynda] : y

Binary file changed: document.pdf

Shall I record this change? (1/7) [Ynda] : y

foobar.txt
@@ -1,3 +1,5 @@
 line1
 line2
+line3
 line4
+line5

Shall I record this change? (2/7) [Ynda] : y

git-darcs-record
@@ -1,17 +1,5 @@
 #!/usr/bin/env python

-# git-darcs-record, emulate "darcs record" interface on top of a git repository
-#
-# Usage:
-# git-darcs-record first asks for any new file (previously
-#    untracked) to be added to the index.
-# git-darcs-record then asks for each hunk to be recorded in
-#    the next commit. File deletion and binary blobs are supported
-# git-darcs-record finally asks for a small commit message and
-#    executes the 'git commit' command with the newly created
-#    changeset in the index
-
-
 # Copyright (C) 2007 Raphaël Slinckx
 #
 # This program is free software; you can redistribute it and/or

Shall I record this change? (3/7) [Ynda] : y

git-darcs-record
@@ -28,6 +16,19 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

+# git-darcs-record, emulate "darcs record" interface on top of a git repository
+#
+# Usage:
+# git-darcs-record first asks for any new file (previously
+#    untracked) to be added to the index.
+# git-darcs-record then asks for each hunk to be recorded in
+#    the next commit. File deletion and binary blobs are supported
+# git-darcs-record finally asks for a small commit message and
+#    executes the 'git commit' command with the newly created
+#    changeset in the index
+
+
+
 import re, pprint, sys, os

 BINARY = re.compile("GIT binary patch")

Shall I record this change? (4/7) [Ynda] : n

git-darcs-record
@@ -151,16 +152,6 @@ def read_answer(question, allowed_responses=["Y", "n", "d", "a"]):
        return resp

-def setup_git_dir():
-       global GIT_DIR
-       GIT_DIR = os.getcwd()
-       while not os.path.exists(os.path.join(GIT_DIR, ".git")):
-               GIT_DIR = os.path.dirname(GIT_DIR)
-               if GIT_DIR == "/":
-                       return False
-       os.chdir(GIT_DIR)
-       return True
-
 def git_get_untracked_files():

Shall I record this change? (5/7) [Ynda] : y

# On branch master
# Changes to be committed:
#   (use "git reset HEAD file..." to unstage)
#
#       modified:   document.pdf
#       modified:   foobar.txt
#       modified:   git-darcs-record
#       new file:   newfile.txt
#
# Changed but not updated:
#   (use "git add file file..." to update what will be committed)
#
#       modified:   git-darcs-record
#
What is the patch name? Some cute patch name
Created commit a08f34e: Some cute patch name
 4 files changed, 3 insertions(+), 29 deletions(-)
 create mode 100644 newfile.txt</pre>
<p>Get the script here: <a href="http://raphael.slinckx.net/files/git-darcs-record">git-darcs-record script</a> and put in somewhere in your $PATH. Any comments or improvements is welcome !</p>
]]></content:encoded>
			<wfw:commentRss>http://raphael.slinckx.net/blog/2007-11-03/git-commit-darcs-record/feed</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
	</channel>
</rss>

