Eskil

Diff
Login

Differences From Artifact [3c378c5c67]:

To Artifact [4969fabc03]:


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
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
    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
    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
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
    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 $precmd $postcmd 1]
    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
    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
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 precmd postcmd {useSts 0}} {
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
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 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
    }