aboutsummaryrefslogtreecommitdiff
path: root/doc/todo/rcs__95__diff_implementation_for_Mercurial_backend__44___based_on_Git_backend...
diff options
context:
space:
mode:
authorhttps://www.google.com/accounts/o8/id?id=AItOawmUWmB1M35_jviFvGPYDIH-a-_Al-7OrXM <Daniel@web>2011-07-19 09:05:03 -0400
committeradmin <admin@branchable.com>2011-07-19 09:05:03 -0400
commit692b70d50424bffe7d02238cd1fca1d3467d37ef (patch)
treebc54fbfb6d1aec761deae976ef722bef08cbd22b /doc/todo/rcs__95__diff_implementation_for_Mercurial_backend__44___based_on_Git_backend.mdwn
parent412aeab752b87548d13d346e250f41a99638b550 (diff)
downloadikiwiki-692b70d50424bffe7d02238cd1fca1d3467d37ef.tar
ikiwiki-692b70d50424bffe7d02238cd1fca1d3467d37ef.tar.gz
Diffstat (limited to 'doc/todo/rcs__95__diff_implementation_for_Mercurial_backend__44___based_on_Git_backend.mdwn')
-rw-r--r--doc/todo/rcs__95__diff_implementation_for_Mercurial_backend__44___based_on_Git_backend.mdwn38
1 files changed, 38 insertions, 0 deletions
diff --git a/doc/todo/rcs__95__diff_implementation_for_Mercurial_backend__44___based_on_Git_backend.mdwn b/doc/todo/rcs__95__diff_implementation_for_Mercurial_backend__44___based_on_Git_backend.mdwn
new file mode 100644
index 000000000..8843e0c86
--- /dev/null
+++ b/doc/todo/rcs__95__diff_implementation_for_Mercurial_backend__44___based_on_Git_backend.mdwn
@@ -0,0 +1,38 @@
+(**Note:** this patch is built on top of [[Attempt to extend Mercurial backend support]] and [[rcs__95__get__123__c__44__m__125__time_implementation_for_Mercurial_backend__44___based_on_Git_backend]]. The former is needed for the `safe_hg()` definition. The latter only shows up in the very last line matching of this patch.)
+
+CC of `rcs_diff` implementation in `git.pm` with few changes. Mercurial provides the `hg diff -g` switch, which outputs the diff in Git-format, making the implementation easy. I think it's a good idea to base `mercurial.pm` as much as possible om `git.pm` to simplify and be able to benefit from the maintenance of `git.pm`, which probably is more used.
+
+[Patch at my hg repo](http://510x.se/hg/program/ikiwiki/diff/cc73d670bf99/Plugin/mercurial.pm) ([raw format](http://510x.se/hg/program/ikiwiki/raw-file/cc73d670bf99/Plugin/mercurial.pm)).
+
+--[[Daniel Andersson]]
+
+---
+
+ diff -r 1b6c46b62a28 -r cc73d670bf99 Plugin/mercurial.pm
+ --- a/Plugin/mercurial.pm Tue Jul 19 13:35:17 2011 +0200
+ +++ b/Plugin/mercurial.pm Tue Jul 19 13:35:37 2011 +0200
+ @@ -307,7 +307,23 @@
+ }
+
+ sub rcs_diff ($;$) {
+ - # TODO
+ + my $rev=shift;
+ + my $maxlines=shift;
+ + my @lines;
+ + my $addlines=sub {
+ + my $line=shift;
+ + return if defined $maxlines && @lines == $maxlines;
+ + push @lines, $line."\n"
+ + if (@lines || $line=~/^diff --git/);
+ + return 1;
+ + };
+ + safe_hg(undef, $addlines, "hg", "diff", "-c", $rev, "-g");
+ + if (wantarray) {
+ + return @lines;
+ + }
+ + else {
+ + return join("", @lines);
+ + }
+ }
+
+ {