Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Changes In Branch tclfossil-1
Excluding Merge-Ins
This is equivalent to a diff from
348e45b0d6
to 8c4b530084
 
| 
   2008-02-19 
 |  |  | 
| 21:58 | 
 | 
Closed-Leaf
check-in: 8c4b530084 user: mjanssen tags: tclfossil-1
 | 
| 18:05 | 
 | 
check-in: 2b9c6df430 user: mjanssen tags: tclfossil-1
 | 
| 
   2008-01-31 
 |  |  | 
| 05:39 | 
 | 
check-in: 3cd599cacd user: aku tags: trunk
 | 
| 
   2008-01-30 
 |  |  | 
| 21:53 | 
 | 
check-in: abbdb0e8c9 user: mjanssen tags: tclfossil-1
 | 
| 08:28 | 
 | 
check-in: 348e45b0d6 user: aku tags: trunk
 | 
| 08:25 | 
 | 
check-in: f9e0d23d97 user: aku tags: trunk
 | 
 |  |  | 
Added tools/tclfossil/dependencies.txt.
  | 
1
  | 
+
  | 
zlib: http://pascal.scheffers.net/software/zlib-1.1.1.tar.bz2
  | 
Added tools/tclfossil/goals.txt.
  | 
1
2
3
4
5
6
  | 
+
+
+
+
+
+
  | 
* use Tcl and the sqlite3 extensions to provide a CLI to fossil
* use Tcl sockets and events to prevent having to use non-portable things like fork
* get fossil on all platforms that support Tcl and SQlite
* allow easy extensibility using Tcl
* provide performance critical parts as TEA extensions
* allow apps to use DVCS by package require fossil
  |  
  |    |    |    |    | 
Added tools/tclfossil/lib/vc/fossil/blob-1.0.tm.
  | 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
  | 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
  | 
## -*- tcl -*-
# # ## ### ##### ######## ############# #####################
## Copyright (c) 2008 Mark Janssen.
#
# This software is licensed as described in the file LICENSE, which
# you should have received as part of this distribution.
#
# This software consists of voluntary contributions made by many
# individuals.  For exact contribution history, see the revision
# history and logs, available at http://fossil-scm.hwaci.com/fossil
# # ## ### ##### ######## ############# #####################
## Commands for creating and managing fossil blobs.
# # ## ### ##### ######## ############# #####################
## Requirements
package require Tcl 8.5                             ; # Required runtime.
package require sqlite3                             ; # Fossil database access
package require snit                                ; # OO system.
package require zlib
package provide vc::fossil::blob 1.0
# # ## ### ##### ######## ############# #####################
##
namespace eval ::vc::fossil {
    namespace export blob
    snit::type blob {
	option -data ""
	constructor {args} {
	    $self configurelist $args
	}
	method compress {} {
	    set data [$self cget -data]
	    set n [string length $data]
	    set data [zlib compress $data 9]
	    set header [binary format I $n]
	    return $header$data
	}
	method  decompress {} {
	    set data [$self cget -data]
	    binary scan $data I length
	    return [zlib decompress [string range $data 4 end] $length ]
	} 
    }
}
 |  
  |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    | 
Added tools/tclfossil/lib/vc/fossil/cmd-1.0.tm.
  | 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
  | 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
  | 
## -*- tcl -*-
# # ## ### ##### ######## ############# #####################
## Copyright (c) 2008 Mark Janssen.
#
# This software is licensed as described in the file LICENSE, which
# you should have received as part of this distribution.
#
# This software consists of voluntary contributions made by many
# individuals.  For exact contribution history, see the revision
# history and logs, available at http://fossil-scm.hwaci.com/fossil
# # ## ### ##### ######## ############# #####################
## Fossil subcommand managment.
# # ## ### ##### ######## ############# #####################
## Requirements
package require Tcl 8.5                             ; # Required runtime.
package require sqlite3                             ; # Fossil database access
package require snit                                ; # OO system.
package provide vc::fossil::cmd 1.0
# # ## ### ##### ######## ############# #####################
##
namespace eval ::vc::fossil {
    namespace export cmd
    snit::type cmd {
	typevariable commands ""
	typemethod add {command} {
	    lappend commands $command
	    
	}
	
	typemethod list {} {
	    return $commands
	}
    }
}
 |  
  |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    | 
Added tools/tclfossil/lib/vc/fossil/cmd/clone-1.0.tm.
  | 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
  | 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
  | 
## -*- tcl -*-
# # ## ### ##### ######## ############# #####################
## Copyright (c) 2008 Mark Janssen.
#
# This software is licensed as described in the file LICENSE, which
# you should have received as part of this distribution.
#
# This software consists of voluntary contributions made by many
# individuals.  For exact contribution history, see the revision
# history and logs, available at http://fossil-scm.hwaci.com/fossil
# # ## ### ##### ######## ############# #####################
# # ## ### ##### ######## ############# #####################
## Requirements
package require Tcl 8.5                             ; # Required runtime.
package require snit                                ; # OO system.
package require vc::fossil::cmd 1.0                 ; # Subcommand management
package require vc::fossil::blob 1.0
                
package provide vc::fossil::cmd::clone 1.0
# # ## ### ##### ######## ############# #####################
## Imports
namespace import ::vc::fossil::blob
# # ## ### ##### ######## ############# #####################
##
vc::fossil::cmd add clone
namespace eval ::vc::fossil::cmd {
    proc clone {args} {
	if {[ui argc] != 4} {
	    ui usage "FILE-OR-URL NEW-REPOSITORY"
	}
	
	set local_file [lindex [ui argv] 3]
	if {[file exists $local_file]} {
	    ui panic "file already exists: $local_file"
	}
	puts "cloning: $args"
	package require http
	package require sha1
	package require autoproxy
	autoproxy::init
	puts [autoproxy::configure]
	proc login_card {userid password message} {
	    # calculates the login card for the specific user for this msg
	    set nonce [sha1::sha1 -hex $message]
	    set signature [sha1::sha1 -hex $nonce$password]
	    return "login $userid $nonce $signature\n"
	}
	proc http_req {url user password message} {
	    set login_card [login_card $user $password $message]
	    blob blob_a -data $login_card$message
	    set message [blob_a compress]
	    blob_a destroy
	    return [http::geturl $url/xfer -binary 1 -query $message -type application/x-fossil]
	}
	set tok [http_req http://www.fossil-scm.org/fossil MJanssen {} clone\n]
	http::wait $tok
	set zip_body  [http::data $tok]
	blob blob_a -data $zip_body
	set body [blob_a decompress]
	blob_a destroy
	set lines [split $body \n] 
	puts $body
	puts "Received:\t[string length $body] ([string length $zip_body]) bytes,\t[llength $lines] messages"
    }
}
 |  
  |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    | 
Added tools/tclfossil/lib/vc/fossil/cmd/new-1.0.tm.
  | 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
  | 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
  | 
## -*- tcl -*-
# # ## ### ##### ######## ############# #####################
## Copyright (c) 2008 Mark Janssen.
#
# This software is licensed as described in the file LICENSE, which
# you should have received as part of this distribution.
#
# This software consists of voluntary contributions made by many
# individuals.  For exact contribution history, see the revision
# history and logs, available at http://fossil-scm.hwaci.com/fossil
# # ## ### ##### ######## ############# #####################
# # ## ### ##### ######## ############# #####################
## Requirements
package require Tcl 8.5                             ; # Required runtime.
package require snit                                ; # OO system.
package require vc::fossil::cmd 1.0                 ; # Subcommand management
package require vc::fossil::db 1.0
                
package provide vc::fossil::cmd::new 1.0
vc::fossil::cmd add new
# # ## ### ##### ######## ############# #####################
## Imports
# # ## ### ##### ######## ############# #####################
##
namespace eval ::vc::fossil::cmd {
    proc new {args} {
	if {[ui argc] != 3} {
	    ui usage "REPOSITORY-NAME"
	}
	
	set filename [file normalize [lindex [ui argv] 2]]
	db create_repository $filename
		       
    }
}
 |  
  |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    | 
Added tools/tclfossil/lib/vc/fossil/db-1.0.tm.
  | 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
  | 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
  | 
## -*- tcl -*-
# # ## ### ##### ######## ############# #####################
## Copyright (c) 2008 Mark Janssen.
#
# This software is licensed as described in the file LICENSE, which
# you should have received as part of this distribution.
#
# This software consists of voluntary contributions made by many
# individuals.  For exact contribution history, see the revision
# history and logs, available at http://fossil-scm.hwaci.com/fossil
# # ## ### ##### ######## ############# #####################
## Db commands
# # ## ### ##### ######## ############# #####################
## Requirements
package require Tcl 8.5                             ; # Required runtime.
package require snit                                ; # OO system.
package require sqlite3
package require vc::fossil::schema      1.0         ; # Fossil repo schema
package provide vc::fossil::db 1.0
# # ## ### ##### ######## ############# #####################
##
namespace eval ::vc::fossil {
    snit::type db {
	typevariable schemadir [file join [file dirname [info script]] schema]
        typevariable dbcmd [namespace current]::sqldb
	typemethod create_repository {filename} {
	    if {[file exists $filename]} {
		ui panic "file already exists: $filename"
	    }
	    db init_database $filename [schema repo1] [schema repo2]
	}
	typemethod init_database {filename schema args} {
	    sqlite3 $dbcmd $filename
	    $dbcmd transaction {
		$dbcmd eval $schema
		foreach schema $args {
		    $dbcmd eval $schema
		}
	    }
	    $dbcmd close
	}
    }
}
 |  
  |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    | 
Added tools/tclfossil/lib/vc/fossil/schema-1.0.tm.