Eskil

Check-in [4e65a43252]
Login

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

Overview
Comment:Added support for Fossil revision control.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 4e65a43252f6f4c9992c3e47c8fc5937d5759af3
User & Date: peter.spjuth@gmail.com 2011-03-30 23:36:45.000
Context
2011-03-31
23:19
Started on change list for 2.5 check-in: 2f91931ad3 user: peter.spjuth@gmail.com tags: trunk
2011-03-30
23:36
Added support for Fossil revision control. check-in: 4e65a43252 user: peter.spjuth@gmail.com tags: trunk
2011-03-29
19:26
Updated paths for new machine. check-in: 2e04012d77 user: peter.spjuth@gmail.com tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to Changes.



1
2
3
4
5
6
7



2010-11-07
 Added tkdnd support. [FR 5125]

2010-11-07
 Autodetect line endings in conflict file.
 Allow line ending selection in merge save. [FR 5160]
 Added menu bar to merge window.
>
>
>







1
2
3
4
5
6
7
8
9
10
2011-03-31
 Added support for Fossil revision control.

2010-11-07
 Added tkdnd support. [FR 5125]

2010-11-07
 Autodetect line endings in conflict file.
 Allow line ending selection in merge save. [FR 5160]
 Added menu bar to merge window.
Changes to doc/revision.txt.
1
2
3
4
5
6
7
8
9
Eskil can compare versions in revision control systems.
Currently RCS, CVS, Git, Mercurial, Bazaar, Subversion and ClearCase
are supported.

If you specify only one file on the command line to Eskil, it will automatically detect if the file is under revision control and enter revision 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.  It works like it does in "cvs diff".  Examples:

|







1
2
3
4
5
6
7
8
9
Eskil can compare versions in revision control systems.
Currently RCS, CVS, Git, Fossil, Mercurial, Bazaar, Subversion and ClearCase
are supported.

If you specify only one file on the command line to Eskil, it will automatically detect if the file is under revision control and enter revision 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.  It works like it does in "cvs diff".  Examples:
48
49
50
51
52
53
54




55
56
57
58
59
60
61

For Subversion the arguments to -r are standard version numbers just like its -r option.  If a revision is a negative integer, the log is searched backwards for earlier versions. E.g. -1 gives the second to last version.

<ul>Git</ul>

For Git -r <rev> is passed to show, as in "git show <rev>:<file>".





<ul>Mercurial</ul>

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

<ul>Bazaar</ul>

For Bazaar -r works as in "bzr cat -r".







>
>
>
>







48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65

For Subversion the arguments to -r are standard version numbers just like its -r option.  If a revision is a negative integer, the log is searched backwards for earlier versions. E.g. -1 gives the second to last version.

<ul>Git</ul>

For Git -r <rev> is passed to show, as in "git show <rev>:<file>".

<ul>Fossil</ul>

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

<ul>Mercurial</ul>

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

<ul>Bazaar</ul>

For Bazaar -r works as in "bzr cat -r".
Changes to src/rev.tcl.
63
64
65
66
67
68
69

70
71
72
73
74
75
76
# If implemented, enables the log feature when comparing revisions.
# View log between displayed versions

namespace eval eskil::rev::CVS {}
namespace eval eskil::rev::RCS {}
namespace eval eskil::rev::CT {}
namespace eval eskil::rev::GIT {}

namespace eval eskil::rev::SVN {}
namespace eval eskil::rev::HG {}
namespace eval eskil::rev::BZR {}
namespace eval eskil::rev::P4 {}

proc eskil::rev::CVS::detect {file} {
    if {$file eq ""} {







>







63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# If implemented, enables the log feature when comparing revisions.
# View log between displayed versions

namespace eval eskil::rev::CVS {}
namespace eval eskil::rev::RCS {}
namespace eval eskil::rev::CT {}
namespace eval eskil::rev::GIT {}
namespace eval eskil::rev::FOSSIL {}
namespace eval eskil::rev::SVN {}
namespace eval eskil::rev::HG {}
namespace eval eskil::rev::BZR {}
namespace eval eskil::rev::P4 {}

proc eskil::rev::CVS::detect {file} {
    if {$file eq ""} {
171
172
173
174
175
176
177


















178
179
180
181
182
183
184
    # Git, detect two steps down. Could be improved. FIXA
    if {[file isdirectory [file join $dir .git]] ||
        [file isdirectory [file join $dir .. .git]] ||
        [file isdirectory [file join $dir .. .. .git]]} {
        if {[auto_execok git] ne ""} {
            return 1
        }


















    }
    return 0
}

proc eskil::rev::P4::detect {file} {
    if {[auto_execok icmp4] != ""} {
        if {[catch {exec csh -c "icmp4 have $file"} p4have]} { return 0 }







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







172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
    # Git, detect two steps down. Could be improved. FIXA
    if {[file isdirectory [file join $dir .git]] ||
        [file isdirectory [file join $dir .. .git]] ||
        [file isdirectory [file join $dir .. .. .git]]} {
        if {[auto_execok git] ne ""} {
            return 1
        }
    }
    return 0
}

proc eskil::rev::FOSSIL::detect {file} {
    if {$file eq ""} {
        set dir [pwd]
    } else {
        set dir [file dirname $file]
    }
    # Fossil, detect three steps down. Could be improved. FIXA
    if {[file exists [file join $dir _FOSSIL_]] ||
        [file exists [file join $dir .. _FOSSIL_]] ||
        [file exists [file join $dir .. .. _FOSSIL_]] ||
        [file exists [file join $dir .. .. .. _FOSSIL_]]} {
        if {[auto_execok fossil] ne ""} {
            return 1
        }
    }
    return 0
}

proc eskil::rev::P4::detect {file} {
    if {[auto_execok icmp4] != ""} {
        if {[catch {exec csh -c "icmp4 have $file"} p4have]} { return 0 }
415
416
417
418
419
420
421

































422
423
424
425
426
427
428

    if {[catch {eval $cmd} res]} {
        tk_messageBox -icon error -title "GIT error" -message $res
        return ""
    }
    return $res
}


































# Get a ClearCase revision
proc eskil::rev::CT::get {filename outfile rev} {
    set filerev [file nativename $filename@@$rev]
    if {[catch {exec cleartool get -to $outfile $filerev} msg]} {
        tk_messageBox -icon error -title "Cleartool error" -message $msg
        return







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







434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480

    if {[catch {eval $cmd} res]} {
        tk_messageBox -icon error -title "GIT error" -message $res
        return ""
    }
    return $res
}

# Get a FOSSIL revision
# No support for revisions yet
proc eskil::rev::FOSSIL::get {filename outfile rev} {
    set old [pwd]
    set dir [file dirname $filename]
    set tail [file tail $filename]
    # Locate the top directory
    while {![file exists $dir/_FOSSIL_]} {
        set thisdir [file tail $dir]
        set dir [file dirname $dir]
        set tail [file join $thisdir $tail]
    }
    cd $dir
    if {$rev eq "HEAD"} {
        catch {exec fossil finfo -p $tail > $outfile}
    } else {
        catch {exec fossil finfo -p $tail -r $rev > $outfile}
    }
    cd $old
}

# Get a FOSSIL patch
proc eskil::rev::FOSSIL::getPatch {revs} {
    set cmd [list exec fossil diff]
    # No rev support yet

    if {[catch {eval $cmd} res]} {
        tk_messageBox -icon error -title "FOSSIL error" -message $res
        return ""
    }
    return $res
}

# Get a ClearCase revision
proc eskil::rev::CT::get {filename outfile rev} {
    set filerev [file nativename $filename@@$rev]
    if {[catch {exec cleartool get -to $outfile $filerev} msg]} {
        tk_messageBox -icon error -title "Cleartool error" -message $msg
        return
536
537
538
539
540
541
542
















543
544
545
546
547
548
549
    set result ""
    foreach rev $revs {
        switch -glob -- $rev {
            HEAD - master - * { # Let anything through for now
                lappend result $rev
            }
        }
















    }
    if {[llength $result] == 0} {
        set result [list HEAD]
    }
    return $result
}








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







588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
    set result ""
    foreach rev $revs {
        switch -glob -- $rev {
            HEAD - master - * { # Let anything through for now
                lappend result $rev
            }
        }
    }
    if {[llength $result] == 0} {
        set result [list HEAD]
    }
    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
            }
        }
    }
    if {[llength $result] == 0} {
        set result [list HEAD]
    }
    return $result
}

776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
        if {![file exists $file]} { return "" }

        if {[info exists cache($file)]} {
            return $cache($file)
        }
    }
    
    set searchlist [list $preference GIT HG BZR P4]
    foreach ns [namespace children eskil::rev] {
        lappend searchlist [namespace tail $ns]
    }
    foreach rev $searchlist {
        set result [eskil::rev::${rev}::detect $file]
        if {$result} {
            set cache($file) $rev







|







844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
        if {![file exists $file]} { return "" }

        if {[info exists cache($file)]} {
            return $cache($file)
        }
    }
    
    set searchlist [list $preference GIT FOSSIL HG BZR P4]
    foreach ns [namespace children eskil::rev] {
        lappend searchlist [namespace tail $ns]
    }
    foreach rev $searchlist {
        set result [eskil::rev::${rev}::detect $file]
        if {$result} {
            set cache($file) $rev
Changes to tests/rev.test.
277
278
279
280
281
282
283


















284
285
286
287
288
289
290
        file delete .bzr
    }
    set res
} -cleanup {
    tcltest::removeFile {} _rev2_11
} -result {BZR}



















test rev-3.1 {
    Subversion revisions
} -body {
    eskil::rev::SVN::ParseRevs filename -1
} -result {157}

test rev-3.2 {







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







277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
        file delete .bzr
    }
    set res
} -cleanup {
    tcltest::removeFile {} _rev2_11
} -result {BZR}

test rev-2.12 {
    Detecting, Fossil
} -body {
    set f [tcltest::makeFile {} _rev2_12]
    set ::auto_execs(fossil) "x"
    set apa [file exists _FOSSIL_]
    if {!$apa} {
        file mkdir _FOSSIL_
    }
    set res [detectRevSystem $f]
    if {!$apa} {
        file delete _FOSSIL_
    }
    set res
} -cleanup {
    tcltest::removeFile {} _rev2_12
} -result {FOSSIL}

test rev-3.1 {
    Subversion revisions
} -body {
    eskil::rev::SVN::ParseRevs filename -1
} -result {157}

test rev-3.2 {