Eskil

Check-in [a7b1530550]
Login

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

Overview
Comment:Bugfix when committing in GIT from -review
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: a7b1530550da854536e0ec6da3b2be00c2a5b121e632c3048eafe36726f676a0
User & Date: peter 2019-09-10 20:10:32.491
Context
2019-09-13
00:02
Display tabs better in merge window check-in: 2a703e5e70 user: peter tags: trunk
2019-09-10
20:10
Bugfix when committing in GIT from -review check-in: a7b1530550 user: peter tags: trunk
2019-08-28
14:31
Allow multiple pairs of files on the command line to open multiple windows. check-in: dba61b718e user: peter tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/rev.tcl.
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
    } elseif {[llength $args] == 1} {
        set target [file tail [lindex $args 0]]
    } else {
        set target "[file tail [lindex $args 0]] ..."
    }
    set precmd [list cvs -q commit -m]
    set postcmd $args
    CommitDialog $top $target CVS $precmd $postcmd
}

# Check in SVN controlled file
proc eskil::rev::SVN::commitFile {top args} {
    if {[llength $args] == 0} {
        set target all
    } elseif {[llength $args] == 1} {
        set target [file tail [lindex $args 0]]
    } else {
        set target "[file tail [lindex $args 0]] ..."
    }
    # Any explict dirs mentioned should not recurse.
    set precmd [list svn -q commit --depth=empty -m]
    set postcmd $args
    CommitDialog $top $target SVN $precmd $postcmd
}

# Does anything else needs to be committed with this file?
# Typically that would be added directories in SVN.
proc eskil::rev::SVN::commitFileDependency {filename} {
    set dir [file dirname $filename]
    set result {}







|














|







1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
    } elseif {[llength $args] == 1} {
        set target [file tail [lindex $args 0]]
    } else {
        set target "[file tail [lindex $args 0]] ..."
    }
    set precmd [list cvs -q commit -m]
    set postcmd $args
    CommitDialog $top $target CVS "" $precmd $postcmd
}

# Check in SVN controlled file
proc eskil::rev::SVN::commitFile {top args} {
    if {[llength $args] == 0} {
        set target all
    } elseif {[llength $args] == 1} {
        set target [file tail [lindex $args 0]]
    } else {
        set target "[file tail [lindex $args 0]] ..."
    }
    # Any explict dirs mentioned should not recurse.
    set precmd [list svn -q commit --depth=empty -m]
    set postcmd $args
    CommitDialog $top $target SVN "" $precmd $postcmd
}

# Does anything else needs to be committed with this file?
# Typically that would be added directories in SVN.
proc eskil::rev::SVN::commitFileDependency {filename} {
    set dir [file dirname $filename]
    set result {}
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336

1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
    } elseif {[llength $args] == 1} {
        set target [file tail [lindex $args 0]]
    } else {
        set target "[file tail [lindex $args 0]] ..."
    }
    set precmd [list hg -q commit -m]
    set postcmd $args
    CommitDialog $top $target HG $precmd $postcmd
}

# Check in GIT controlled file
proc eskil::rev::GIT::commitFile {top args} {
    if {[llength $args] == 0} {
        set target all
    } elseif {[llength $args] == 1} {
        set target [file tail [lindex $args 0]]
    } else {
        set target "[file tail [lindex $args 0]] ..."
    }
    if {[llength $args] == 0} {
        set precmd [list git commit -a -m]
    } else {
        set precmd [list git commit -m]
    }

    set postcmd $args
    set gitmsg [CommitDialog $top $target GIT $precmd $postcmd 1]
    if {[string match "*detached HEAD*" $gitmsg]} {
        # Make sure to make a detached HEAD commit visible.
        tk_messageBox -icon info -title "GIT commit message" -message $gitmsg \
                -parent $top
    }
}

# Check in Fossil controlled file
proc eskil::rev::FOSSIL::commitFile {top args} {
    if {[llength $args] == 0} {
        set target all
    } elseif {[llength $args] == 1} {
        set target [file tail [lindex $args 0]]
    } else {
        set target "[file tail [lindex $args 0]] ..."
    }
    set precmd [list fossil commit -m]
    set postcmd $args
    CommitDialog $top $target Fossil $precmd $postcmd 1
}


# Revert SVN controlled file
proc eskil::rev::SVN::revertFile {top args} {
    if {[llength $args] == 0} {
        set target all







|
















>

|


















|







1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
    } elseif {[llength $args] == 1} {
        set target [file tail [lindex $args 0]]
    } else {
        set target "[file tail [lindex $args 0]] ..."
    }
    set precmd [list hg -q commit -m]
    set postcmd $args
    CommitDialog $top $target HG "" $precmd $postcmd
}

# Check in GIT controlled file
proc eskil::rev::GIT::commitFile {top args} {
    if {[llength $args] == 0} {
        set target all
    } elseif {[llength $args] == 1} {
        set target [file tail [lindex $args 0]]
    } else {
        set target "[file tail [lindex $args 0]] ..."
    }
    if {[llength $args] == 0} {
        set precmd [list git commit -a -m]
    } else {
        set precmd [list git commit -m]
    }
    GetTopDir [pwd] topdir _
    set postcmd $args
    set gitmsg [CommitDialog $top $target GIT $topdir $precmd $postcmd 1]
    if {[string match "*detached HEAD*" $gitmsg]} {
        # Make sure to make a detached HEAD commit visible.
        tk_messageBox -icon info -title "GIT commit message" -message $gitmsg \
                -parent $top
    }
}

# Check in Fossil controlled file
proc eskil::rev::FOSSIL::commitFile {top args} {
    if {[llength $args] == 0} {
        set target all
    } elseif {[llength $args] == 1} {
        set target [file tail [lindex $args 0]]
    } else {
        set target "[file tail [lindex $args 0]] ..."
    }
    set precmd [list fossil commit -m]
    set postcmd $args
    CommitDialog $top $target Fossil "" $precmd $postcmd 1
}


# Revert SVN controlled file
proc eskil::rev::SVN::revertFile {top args} {
    if {[llength $args] == 0} {
        set target all
1796
1797
1798
1799
1800
1801
1802

1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
        return [file join $penultimate $last]
    }
}

# Dialog for commit, getting log message
# target: String shown in dialog
# system: Rev System

# precmd: Command part before message
# postcmd: Command part after message. Assumed to be files.
# useSts: Use status from exec rather than message to recognise error.
proc CommitDialog {top target system precmd postcmd {useSts 0}} {
    set w $top.logmsg
    destroy  $w
    toplevel $w -padx 3 -pady 3
    wm title $w "Commit log message for $target"

    set ::eskil($top,logdialogok) 0








>



|







1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
        return [file join $penultimate $last]
    }
}

# Dialog for commit, getting log message
# target: String shown in dialog
# system: Rev System
# topdir: Directory to execute commit in, if given.
# precmd: Command part before message
# postcmd: Command part after message. Assumed to be files.
# useSts: Use status from exec rather than message to recognise error.
proc CommitDialog {top target system topdir precmd postcmd {useSts 0}} {
    set w $top.logmsg
    destroy  $w
    toplevel $w -padx 3 -pady 3
    wm title $w "Commit log message for $target"

    set ::eskil($top,logdialogok) 0

1889
1890
1891
1892
1893
1894
1895



1896

1897
1898
1899
1900
1901
1902
1903
    # Splash screen for visual feedback
    set now [clock clicks -milliseconds]
    ttk::label $w.splash -text "Committing" -anchor center -font myfont
    place $w.splash -x 0 -y 0 -relwidth 1.0 -relheight 1.0
    update
    # Commit
    set cmd [list {*}$precmd $res {*}$todo]



    set sts [catch {exec {*}$cmd} msg]

    set msg [string trim $msg]
    if {($useSts && $sts) || (!$useSts && $msg ne "")} {
        destroy $w
        tk_messageBox -icon error -title "$system commit error" -message $msg \
                -parent $top
        return
    }







>
>
>
|
>







1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
    # Splash screen for visual feedback
    set now [clock clicks -milliseconds]
    ttk::label $w.splash -text "Committing" -anchor center -font myfont
    place $w.splash -x 0 -y 0 -relwidth 1.0 -relheight 1.0
    update
    # Commit
    set cmd [list {*}$precmd $res {*}$todo]
    if {$topdir ne ""} {
        set sts [catch {execDir $topdir {*}$cmd} msg]
    } else {
        set sts [catch {exec {*}$cmd} msg]
    }
    set msg [string trim $msg]
    if {($useSts && $sts) || (!$useSts && $msg ne "")} {
        destroy $w
        tk_messageBox -icon error -title "$system commit error" -message $msg \
                -parent $top
        return
    }