Fossil Wrapper

Check-in [afd3dfc92b]
Login

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

Overview
Comment:Change to root directory if not file is specified. The patch returned by diff contains absolute paths.
Timelines: family | ancestors | descendants | both | record
Files: files | file ages | folders
SHA1: afd3dfc92bedd32239a97164323596dd3444e2f5
User & Date: fifr 2014-05-17 17:46:24
Context
2014-05-28
11:28
Add record help text on input '?'. check-in: 279dbb630f user: fifr tags: record
2014-05-17
17:46
Change to root directory if not file is specified. The patch returned by diff contains absolute paths. check-in: afd3dfc92b user: fifr tags: record
2014-05-07
09:25
Add fslrc with record command. check-in: f125de3204 user: fifr tags: record
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to fslrc.

123
124
125
126
127
128
129







130
131
132
133
134
135
136
...
235
236
237
238
239
240
241


242
243
244

245
246
247
248
249
250
251
# patch. The inverse of this patch is applied to the working directory
# leaving only the selected changes. Then the underlying commit
# command is executed and afterwards the patch is used to restore the
# non-selected changes.
proc recordhunks {files params} {
    set rgxsplit {^(?:Index: .*$\n=+$\n)?^--- ([^\n]*)$\n^\+\+\+ ([^\n]*)$\n((^.+$\n)*)}
    set rgxhunk {^@@.*@@$\n((^[^@I].*$\n)*)}








    # get diff and split into files and hunks
    catch {exec fossil diff -i -c 1 {*}$files} diff

    set files {}
    set start 0
    set nhunks 0
................................................................................
        lappend nopatch "\n"
    }
    set nopatch [join $nopatch {}]
    set fh [open fsl-norecord.patch w 0600]
    puts $fh $nopatch
    close $fh



    exec patch -p0 -R << $nopatch
    catch {fossil {*}$params}
    exec patch -p0 << $nopatch

    
    file delete fsl-record.patch
    file delete fsl-norecord.patch

    return {}
}








>
>
>
>
>
>
>







 







>
>



>







123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
...
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
# patch. The inverse of this patch is applied to the working directory
# leaving only the selected changes. Then the underlying commit
# command is executed and afterwards the patch is used to restore the
# non-selected changes.
proc recordhunks {files params} {
    set rgxsplit {^(?:Index: .*$\n=+$\n)?^--- ([^\n]*)$\n^\+\+\+ ([^\n]*)$\n((^.+$\n)*)}
    set rgxhunk {^@@.*@@$\n((^[^@I].*$\n)*)}

    # get repo root
    set workdir [pwd]
    if {[llength $files] == 0} {
        catch {exec fossil info} inf
        regexp {local-root:\s*(\S+)} $inf m workdir
    }

    # get diff and split into files and hunks
    catch {exec fossil diff -i -c 1 {*}$files} diff

    set files {}
    set start 0
    set nhunks 0
................................................................................
        lappend nopatch "\n"
    }
    set nopatch [join $nopatch {}]
    set fh [open fsl-norecord.patch w 0600]
    puts $fh $nopatch
    close $fh

    set dir [pwd]
    cd $workdir
    exec patch -p0 -R << $nopatch
    catch {fossil {*}$params}
    exec patch -p0 << $nopatch
    cd $dir
    
    file delete fsl-record.patch
    file delete fsl-norecord.patch

    return {}
}