Fossil Wrapper

Check-in [62a73a0f44]
Login

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

Overview
Comment:Added support for 'purge' interceptor to clean MISSING files from repo.
Timelines: family | ancestors | ttmrichter
Files: files | file ages | folders
SHA1: 62a73a0f44421c71c9a93702ed1fe6dd6f49594a
User & Date: michael 2013-01-17 09:43:02
Context
2013-01-17
09:43
Added support for 'purge' interceptor to clean MISSING files from repo. Leaf check-in: 62a73a0f44 user: michael tags: ttmrichter
05:20
Update copyright year and include 'LICENSE' in 'fsl'. Leaf check-in: 06a31756cc user: marc tags: trunk
04:43
Personal branch with personal .fslrc tracked. check-in: 9cd347caaa user: michael tags: ttmrichter
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to LICENSE.

1
2
3
4
5
6
7
8
Copyright (c) 2012, Marc Simpson <marc@0branch.com>

Permission to use, copy, modify, and/or distribute this software for
any purpose with or without fee is hereby granted, provided that the
above copyright notice and this permission notice appear in all
copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
|







1
2
3
4
5
6
7
8
Copyright (c) 2012-3, Marc Simpson <marc@0branch.com>

Permission to use, copy, modify, and/or distribute this software for
any purpose with or without fee is hereby granted, provided that the
above copyright notice and this permission notice appear in all
copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL

Changes to fsl.

1
2
3
4














5
6
7
8
9
10
11
..
61
62
63
64
65
66
67

68
69
70
71
72
73
74
...
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
#!/usr/bin/env expect
# -*-tcl-*-
#
# Copyright (c) 2012, Marc Simpson <marc@0branch.com> (ISC, see LICENSE)















# --( Aliases and Filters )---------------------------------------------

namespace eval config {
    set aliases {}
    set filters {};             # registered filters
    set commands {};            # registered interceptors
................................................................................

    # -- Filters:

    filter status {changes status timeline add rm addremove} {
        lassign [split [string trim $line]] status
        switch $status {
            MERGED_WITH { coloured purple $line }

            ADDED       { coloured  green $line }
            EDITED      { coloured   cyan $line }
            DELETED     { coloured    red $line }
            default     {             set  line }
        }
    }

................................................................................
        if {[interactive? $command]} {
            interact; break
        }
        expect {
            eof { break }
            \n  { filter_with $chain $expect_out(buffer) }
            # Transfer control to user following prompt:
            -re {[\?:] $} {
                if {![log_user]} {
                    send_user $expect_out(buffer)
                }
                interact -o \n { send_user \r\n }
                break
            }
        }



|
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







>







 







|







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
..
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
...
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
#!/usr/bin/env expect
# -*-tcl-*-
#
# Copyright (c) 2012-3, Marc Simpson <marc@0branch.com>
#
# Permission to use, copy, modify, and/or distribute this software for
# any purpose with or without fee is hereby granted, provided that the
# above copyright notice and this permission notice appear in all
# copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
# WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
# AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
# DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
# PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
# TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.

# --( Aliases and Filters )---------------------------------------------

namespace eval config {
    set aliases {}
    set filters {};             # registered filters
    set commands {};            # registered interceptors
................................................................................

    # -- Filters:

    filter status {changes status timeline add rm addremove} {
        lassign [split [string trim $line]] status
        switch $status {
            MERGED_WITH { coloured purple $line }
            MISSING     { coloured yellow $line }
            ADDED       { coloured  green $line }
            EDITED      { coloured   cyan $line }
            DELETED     { coloured    red $line }
            default     {             set  line }
        }
    }

................................................................................
        if {[interactive? $command]} {
            interact; break
        }
        expect {
            eof { break }
            \n  { filter_with $chain $expect_out(buffer) }
            # Transfer control to user following prompt:
            -re {[?:] $} {
                if {![log_user]} {
                    send_user $expect_out(buffer)
                }
                interact -o \n { send_user \r\n }
                break
            }
        }

Changes to fslrc.

109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
...
135
136
137
138
139
140
141


























    set user     $tcl_platform(user)
    set url      [lindex $params 1]
    set password [lindex $params 2]

    fossil clone $url $reponame
    fossil open $reponame

    fossil user new $user
    if {$password != ""} {
        fossil user password $user $password
    }

    return {}
}

................................................................................
        dict lappend seen $fn $interceptor
    }
    dict for {interceptor groups} $seen {
        set disjunction [regsub -all " " $groups "|"]
        puts "$disjunction: [lindex $interceptor 1]"
    }
}

































<







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
109
110
111
112
113
114
115

116
117
118
119
120
121
122
...
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
    set user     $tcl_platform(user)
    set url      [lindex $params 1]
    set password [lindex $params 2]

    fossil clone $url $reponame
    fossil open $reponame


    if {$password != ""} {
        fossil user password $user $password
    }

    return {}
}

................................................................................
        dict lappend seen $fn $interceptor
    }
    dict for {interceptor groups} $seen {
        set disjunction [regsub -all " " $groups "|"]
        puts "$disjunction: [lindex $interceptor 1]"
    }
}

# -- Compounds
# Several commands need interacting aliases, filters, and/or interceptors.
# They go here grouped together.

# fsl purge
# Purge all files flagged as "MISSING".
alias capture_changes changes

filter captured_changes {capture_changes} {
    variable captured
    lappend captured $line
    return {}
}

interceptor purge {
    variable captured {}
    fossil capture_changes
    foreach line $captured {
        if [string match MISSING* $line] {
            regsub ^MISSING $line {} file
            fossil rm [string trim $file]
        }
    }
    return {}
}