Eskil

Check-in [74f1b312e9]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Support negative revisions with Fossil.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 74f1b312e91418f0ff1f3ff927783ecb391c1d30
User & Date: peter 2012-02-28 22:52:13.162
Context
2012-02-28
22:56
Removed debug print. check-in: ed6f0f6f90 user: peter tags: trunk
22:52
Support negative revisions with Fossil. check-in: 74f1b312e9 user: peter tags: trunk
18:19
Corrected SVN branch detection check-in: 3d26b61b4d user: peter tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to Changes.



1
2
3
4
5
6
7



2012-02-21
 Support branches in Subversion. [b71c8cf01b]

2012-02-19
 Support regsub preprocessing controlled per side.

2012-02-18
>
>
>







1
2
3
4
5
6
7
8
9
10
2012-02-28
 Support negative revisions with Fossil.

2012-02-21
 Support branches in Subversion. [b71c8cf01b]

2012-02-19
 Support regsub preprocessing controlled per side.

2012-02-18
Changes to doc/revision.txt.
59
60
61
62
63
64
65




66
67
68
69
70
71
72
<pre>git config --global mergetool.eskil.cmd 'eskil -fine -a $BASE -o $MERGED $REMOTE $LOCAL'</pre>
<pre>git config --global diff.tool eskil</pre>
<pre>git config --global difftool.eskil.cmd 'eskil $LOCAL $REMOTE'</pre>

<ul>Fossil</ul>

For Fossil -r <rev> is passed to finfo, as in "fossil finfo -p <file> -r <rev>".





<pre>fossil settings gmerge-command 'eskil -fine -a "%baseline" "%merge" "%original" -o "%output"' -global</pre>

<ul>Mercurial</ul>

For Mercurial -r works as in "hg cat -r".








>
>
>
>







59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<pre>git config --global mergetool.eskil.cmd 'eskil -fine -a $BASE -o $MERGED $REMOTE $LOCAL'</pre>
<pre>git config --global diff.tool eskil</pre>
<pre>git config --global difftool.eskil.cmd 'eskil $LOCAL $REMOTE'</pre>

<ul>Fossil</ul>

For Fossil -r <rev> is passed to finfo, as in "fossil finfo -p <file> -r <rev>".

Additionaly, if a revision is a negative integer, the log is searched backwards
for earlier versions. E.g. -1 gives the second to last version. The search
follows the current branch from the current version.

<pre>fossil settings gmerge-command 'eskil -fine -a "%baseline" "%merge" "%original" -o "%output"' -global</pre>

<ul>Mercurial</ul>

For Mercurial -r works as in "hg cat -r".

Changes to htdocs/fossil.wiki.
11
12
13
14
15
16
17
18



19
20
21
22
23
24
25
control mode.

By default the local file is compared against the latest checked in version.
This is for the common case when you just want to know what you have changed
before checking in.

You can use the -r option to select which versions to compare.
The -r option works as in fossil finfo.




Examples:

Compare file.txt with the latest checked in version:
<pre>eskil file.txt</pre>

Compare file.txt with the specified version:







|
>
>
>







11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
control mode.

By default the local file is compared against the latest checked in version.
This is for the common case when you just want to know what you have changed
before checking in.

You can use the -r option to select which versions to compare.
The -r option works as in fossil finfo. If a revision is a negative integer,
the log is searched backwards for earlier versions. E.g. -1 gives the second
to last version. The search follows the current branch from the current version.


Examples:

Compare file.txt with the latest checked in version:
<pre>eskil file.txt</pre>

Compare file.txt with the specified version:
Changes to src/rev.tcl.
595
596
597
598
599
600
601























































602
603
604
605
606
607
608
            if {[regexp {r(\d+)} $line -> rev]} {
                lappend revs $rev
            }
        }
    }
    return $revs
}
























































# Figure out RCS revision from arguments
proc eskil::rev::RCS::ParseRevs {filename revs} {
    if {$filename eq ""} {
        # RCS does not support tree versions
        return {}
    }







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
            if {[regexp {r(\d+)} $line -> rev]} {
                lappend revs $rev
            }
        }
    }
    return $revs
}

# Return revision list of a FOSSIL file
proc eskil::rev::FOSSIL::GetRevList {filename} {
    # Keep on current branch
    set x [exec fossil branch list]
    if { ! [regexp -line {^\* (.*)$} $x -> branch]} {
        set branch ""
    }
    
    # First, traverse timeline to get a set of ancestor checkins on the
    # current branch
    set x [exec fossil timeline ancestors current -t ci -n 5000]
    array set ancestors {}
    set lines ""
    set currentArtefact ""
    foreach line [split $x \n] {
        # Recognise the first line of each checkin
        if {[regexp {^\d\d:\d\d:\d\d \[(\w+)\]} $line -> newArtefact]} {
            if {[regexp {tags:\s+([^\)]+)} $lines -> tags]} {
                if {$branch eq ""} {
                    set branch [lindex $tags 0]
                }
                if {$branch in $tags} {
                    set ancestors($currentArtefact) 1
                }
            }
            set currentArtefact $newArtefact
            set lines [string trim $line]
        } else {
            set line [string trim $line]
            if {[string index $lines end] eq "-"} {
                append lines $line
            } else {
                append lines \n$line
            }
        }
    }
    puts "Assuming branch '$branch'"
    puts "Found [array size ancestors] ancestors in timeline"

    # Now get all commits on the file. If finfo had a tag filter,
    # this would be much easier.
    set x [exec fossil finfo -l -b $filename]
    set fAncestors {}
    foreach line [split $x \n] {
        if {[regexp {^(\w+)} $line -> artefact]} {
            if {[info exists ancestors($artefact)]} {
                lappend fAncestors $artefact
            }
        }
    }
    puts "Found [llength $fAncestors] ancestors for file"
    puts [join $fAncestors \n]
    return $fAncestors
}

# Figure out RCS revision from arguments
proc eskil::rev::RCS::ParseRevs {filename revs} {
    if {$filename eq ""} {
        # RCS does not support tree versions
        return {}
    }
622
623
624
625
626
627
628
629


630

631

632
633


634
635
636
637
638
639
640
    return $result
}

# Figure out FOSSIL revision from arguments
proc eskil::rev::FOSSIL::ParseRevs {filename revs} {
    set result ""
    foreach rev $revs {
        switch -glob -- $rev {


            HEAD - master - * { # Let anything through for now FIXA

                lappend result $rev

            }
        }


    }
    return $result
}

# Figure out HG revision from arguments
proc eskil::rev::HG::ParseRevs {filename revs} {
    set result ""







|
>
>
|
>
|
>


>
>







677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
    return $result
}

# Figure out FOSSIL revision from arguments
proc eskil::rev::FOSSIL::ParseRevs {filename revs} {
    set result ""
    foreach rev $revs {
        if {[string is integer -strict $rev] && $rev < 0} {
            # A negative integer rev is a relative rev
            set revs [eskil::rev::FOSSIL::GetRevList $filename]

            set rev [lindex $revs [- $rev]]
            if {$rev eq ""} {
                set rev [lindex $revs end]
            }
        }
        # Let anything through for now FIXA
        lappend result $rev
    }
    return $result
}

# Figure out HG revision from arguments
proc eskil::rev::HG::ParseRevs {filename revs} {
    set result ""