/usr/bin/tkaegis is in aegis-tk 4.24.3-3.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
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 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 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 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 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 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 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 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 | #!/bin/sh
#
# aegis - project change supervisor
# Copyright (C) 1995, 1999 Graham Wheeler
# Copyright (C) 2007, 2008 Peter Miller
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see
# <http://www.gnu.org/licenses/>.
#
# script/tkaegis. Generated from tkaegis.in by configure.
#
# comments wrap in Tcl, but not in sh \
exec wish $0 ${1+"$@"}
#
# written by Graham Wheeler <gram@cdsec.com> Citadel Data Security
#
# v1.0 3/6/95-4/6/95
#
# v1.1 5/6/95 Added view_diffs
# Added cresidue and presidue for unsupported project/change
# attribute preservation
# Avoids showing difference files if no change has been made
# Changed change description to be one line
# Other minor improvements and bug fixes
#
# v1.2 January 1999
# Added a scrolled text area for feedback and debugging
# Menus are no longer tearoff
# Added support for branches
# tkaegis now works with aegis 3.8
#
# Send comments to gram@cdsec.com
#
# TODO:
# Make sure we behave sanely when we do silly stuff - or grey out
# menu items to prevent this
# Improve the layout of the change attributes dialog box
# Add umask support to project attribute edit
# Add architecture support to change attribute edit
# Complete new project release
# Add options to set editor, dependency tools, etc
# Then implement template file generation on first change
# Online Help (ha ha ha!)
#
# There is currently no documentation for tkaegis, other than these
# comments. However, its use should be self-evident to anyone familiar
# with aegis. There are some areas where tkaegis is still missing
# functionality; these are primarily related to project and change
# attributes that are not yet included in the dialogs, and also issues
# such as configuring the change and history tools, the architectures,
# and so on.
#
# The following is a bried description of how tkaegis works.
#
# First, you will need Tcl/Tk installed, and will need to modify the
# path in the first line of tkaegis to reflect the path of your Tk
# wish interpreter. Next, you may need to modify some important
# variables that occur immediately below these comments, to specify
# the architecture, project base directory, and the editor you are
# using (if you leave that blank, tkaegis will try to determine the
# editor to use from the EDITOR environment variable; if that fails,
# it will fall back to emacs or vi).
#
# When you run tkaegis, a window will appear with a menu at the top.
# The window is used to display the output of aegis commands and some
# other feedback. The menu will initially have only two items, Project
# and Help. At this stage the Help menu only has an About dialog box.
#
# The Project menu will allow you to create new projects, select from
# your existing projects, clear the contents of the feedback window,
# or exit the program. If you create a new project, a dialog box will
# appear allowing you to enter the project name, directory, and initial
# branch number. When you press OK the project will be created and should
# then appear in the Project menu.
#
# If you select an existing project, a new option will be added to the
# Project menu, allowing you to delete the project. A Branch menu will
# also appear. This is similar to the Project menu, but allows you to
# create, delete, or select project branches.
#
# If you select a branch in the branch menu, a Role menu will appear.
# This will allow you to choose the role that you will be playing,
# namely one of administrator, developer, reviewer, or integrator.
# tkaegis uses your UNIX login name and the names of the roleplayers
# associated with the project and branch, to determine which of the
# roles it will allow you to choose. If you create a new project, only
# the administrator role will appear.
#
# Selecting a role will put you in a `mode', which will determine what
# other menus appear and what you can do next. Each mode will now be
# described in turn, by giving a brief description of the role-specific
# menu hierarchy. Following the name of each menu item is the corresponding
# aegis command, where applicable.
#
# ADMINISTRATOR MODE
#
# In this mode, you can modify the staff and roles associated with the
# branch, and create, remove, and change the attributes of change requests,
# and view all the change requests.
#
#
# Menu Description
# ---------------------------- --------------------------------------
# Admin: Overall branch admin functions
# Edit Branch Attributes (aepa) Change the attributes for the branch
#
# Staff View or change the branch staff
# Administrators View or change the branch admin staff
# Add (aena) Add an administrator for the branch
# View (ael a) View the administrators for the branch
# Remove (aera) Remove an administrator for the branch
#
# Developers View/change the branch developer staff
# Add (aend) Add a developer for the branch
# View (ael d) View the developers for the branch
# Remove (aerd) Remove a developer for the branch
#
# Reviewers View or change the branch review staff
# Add (aenrv) Add a reviewer for the branch
# View (ael r) View the reviewers for the branch
# Remove (aerrv) Remove a reviewer for the branch
#
# Integrators View or change the branch integrator staff
# Add (aeni) Add an integrator for the branch
# View (ael i) View the integrators for the branch
# Remove (aeri) Remove an integrator for the branch
#
# Change Add, remove, view branch changes
# Add New Change (aenc) Add a new change request
# New Change Undo (aencu) Undo the addition of a change request
# Edit Change Attributes (aeca) Modify the attributes of a change request
# View Changes (ael c) View the set of changes
#
# DEVELOPER MODE
#
# This mode is used by developers. When entering this mode, the Develop
# menu will appear, but no others. A change must be selected after which
# the other menus will appear. If there is only one change awaiting
# development, this will be auto-selected.
#
#
# Menu Description
# ---------------------------- --------------------------------------
# Develop
# View Changes (ael c) View all the change requests
# Begin Change (aedb) Start work on a new change
# Continue Change Continue work on a change in development
# View Differences (aediff) Show all the diffs for this change
# Abort Change (aedbu) Abort working on the change
# End Change (aede) (Attempt to) end working on the change
# Resume Change (aedeu) Resume work on a change awaiting review
#
# File
# Edit Files Allow files to be loaded into an editor
# Add New File (aenf) Add a new file to the project
# Discard New File (aenfu) Discard a newly added file
# Remove Existing File (aerm) Discard a previously existing file
# Restore Existing File (aermu) Undo discard of a previously existing file
# Change Existing File (aecp) Allow an existing file to be edited
# Undo Changes to Existing File (aecpu) Lose changes to an existing file
#
# Build
# Build Project (aeb) Attempt to build the project
#
# Test
# Add New Test Script (aent) Add a new test script to the project
# Discard New Test Script (aentu) Remove a new test script
# Run New Tests (aet) Run the new tests
# Run Regression Tests (aet -reg) Run the old tests
# Run Baseline Test (aet -bl) Run the baseline test
#
#
# REVIEWER MODE
#
# Menu Description
# ---------------------------- --------------------------------------
# Review
# View Changes (ael c) View all the changes
# Begin Review (aerb) Start reviewing a change
# Abort Review (aerbu) Abort reviewing a change
# Pass (aerpass) Pass a change review
# Fail (aerfail) Fail a change review
# Undo Pass (aerpu) Undo a previously passed review
#
# INTEGRATOR MODE
#
# Menu Description
# ---------------------------- --------------------------------------
# Integrate
# View Changes (ael c) View all the changes
# Start Integration (aeib) Start integrating a change
# Resume Integration Resume an integration in progress
# Cancel Integration (aeibu) Cancel an integration
# View Differences (aediff) Show the file differences for the change
# Build (aeb) Build the project
# New Tests (aet) Run the new tests
# Baseline Test (aet -bl) Run the baseline test
# Regression Test (aet -reg) Run the regression tests
# Pass (aeipass) Pass the integration
# Fail (aeifail) Fail the integration
#
#
######################################################################
# These may need to be set according to local preferences:
set bindir /usr/bin
set libdir /usr/share/aegis
set datadir /usr/share/aegis
set datarootdir /usr/share/aegis
#
# set window manager properties for the top-level window
#
wm title . Aegis
wm maxsize . 32767 32767
wm minsize . 200 100
wm iconname . Aegis
wm iconbitmap . @$datadir/aegis.icon
wm iconmask . @$datadir/aegis.mask
set arch "unspecified"
set projbasedir ""
set editor "nedit"
######################################################################
proc AddStatusLine {ln} {
global .work.status
.work.status insert end "$ln\n"
.work.status see end
}
proc ClearStatus {} {
global .work.status
.work.status delete 1.0 end
}
######################################################################
# Wrappers around aegis; try to localise all aegis dependencies here...
# aegis_is_branch returns true if the project name has a trailing
# numerical extension
proc aegis_is_branch {nm} {
return [regexp {.*\.[0-9]+} $nm]
}
proc aegis_do_command {args { rv junk } } {
upvar $rv rtncode
set ecmd "exec aegis $args"
set rtncode [catch $ecmd rtn ]
AddStatusLine "$ecmd => $rtn"
return $rtn
}
proc aegis_get_info_command {cmd} {
set rtn [aegis_do_command $cmd code]
if {$code == 0} {
return $rtn
} else {
show_message "Error" $rtn
return ""
}
}
proc aegis_do_action_command {cmd} {
set msg [aegis_do_command $cmd code]
if {$code == 0} {
return 1
} else {
show_message "Error" $msg
return 0
}
}
# Get the list of projects, including the branches
proc aegis_get_all_projects {} {
return [aegis_get_info_command "-l p -terse"]
}
# Get the list of projects (but not the branches!)
proc aegis_get_core_projects {} {
set rtn ""
set pall [aegis_get_all_projects]
if {$pall != ""} {
foreach p $pall {
if { ! [aegis_is_branch $p] } {
lappend rtn $p
}
}
}
return $rtn
}
# Get the open branches for a project. We assume they are listed by aegis
# from shortest to longest name, and we invert this order.
proc aegis_get_branches {root} {
set rtn ""
set pall [aegis_get_all_projects]
if {$pall != ""} {
foreach p $pall {
if [string match "${root}*" $p] {
set rtn [linsert $rtn 0 $p]
}
}
}
return $rtn
}
# Create a new project or a new branch
proc aegis_new_project {proj vers directory} {
global projbasedir
if {$vers == ""} {set vers "1.0"}
if {$directory == ""} {
set directory "$projbasedir/$proj"
}
AddStatusLine "Creating project $proj branch $vers directory $directory"
return [aegis_do_action_command "-npr $proj -version $vers \
-directory $directory"]
}
proc aegis_new_branch {branch directory} {
set rtn ""
set pos [string last "." $branch]
if {$pos >= 0} {
set p [string range $branch 0 [expr $pos-1]]
set b [string range $branch [expr $pos+1] end]
AddStatusLine "Creating branch $branch"
if {$directory != ""} {
return [aegis_do_action_command "-nbr -p $p -dir $directory $b"]
} else {
return [aegis_do_action_command "-nbr -p $p $b"]
}
}
return 1
}
# Delete a project and all its branches. Use with care!
#
# We have to find all the subbranches that are open, and
# do `develop begin undo' and `new change undo' on them before
# we can delete the project
# We return 0 if nothing was deleted, 1 if all branches were
# deleted, or -1 if some were deleted.
proc aegis_delete_branches {branches} {
set rtn 0
if {$branches == ""} { return 1 }
foreach b $branches {
if {[get_confirm "Delete branch $b?"]} {
AddStatusLine "Deleting branch $b"
set pos [string last "." $b]
if {$pos >= 0} {
set p [string range $b 0 [expr $pos-1]]
set c [string range $b [expr $pos+1] end]
if [aegis_do_action_command "-dbu $p $c"] {
if [aegis_do_action_command "-ncu $p $c"] {
} else {
return -1
}
} else {
return -1
}
}
set rtn 1
} else {
return -1
}
}
return $rtn
}
proc aegis_delete_branch {branch} {
return [aegis_delete_branches [aegis_get_branches $branch]]
}
proc aegis_delete_project {proj} {
if {[aegis_delete_branches [aegis_get_branches $proj]] == 1} {
AddStatusLine "Deleting project $proj"
return [aegis_do_action_command "-rmpr $proj"]
}
return 0
}
proc aegis_get_project_attributes {proj} {
return [aegis_get_info_command "-pa -list -p $proj"]
}
proc aegis_set_project_attributes {proj attr_file} {
aegis_do_action_command "-pa -p $proj -file $attr_file"
}
proc aegis_has_role {role user proj} {
if {$proj != ""} {
set rv [aegis_do_command "-l $role -p $proj -terse | fgrep $user" code]
if {$code == 0 && $rv==$user} { return 1 }
}
return 0
}
proc aegis_get_roleplayers {proj typcode} {
return [aegis_get_info_command "-l $typcode -p $proj -terse | sort"]
}
proc aegis_get_possible_roleplayers {} {
set code [catch {exec cut -f1 -d: /etc/passwd | sort} users]
if {$code == 0} { return $users} else {return ""}
}
proc aegis_get_changelog {branch} {
return [aegis_get_info_command "-l c -p $branch -verbose"]
}
proc aegis_create_new_change {branch attrfile} {
return [aegis_do_action_command "-nc -p $branch -file $attrfile"]
}
proc aegis_new_change_undo {branch change} {
return [aegis_do_action_command "-ncu -p $branch -c $change"]
}
proc aegis_get_change_attributes {branch change} {
return [aegis_get_info_command "-ca -list -p $branch -c $change"]
}
proc aegis_set_change_attributes {branch change fname} {
return [aegis_do_action_command "-ca -p $branch -c $change -file $fname"]
}
proc aegis_get_change_details {branch change} {
return [aegis_get_info_command "-l cd -p $branch -c $change -verbose"]
}
proc aegis_choose_change {act cmd} {
global branch change
set oldchange $change
set cnt 0
toplevel .ccpanel
if {$act == ""} {
set title "Choose change"
} else {
set title "Choose change to $act"
}
wm title .ccpanel $title
frame .ccpanel.but
listbox .ccpanel.entries -relief raised -borderwidth 2 \
-yscrollcommand ".ccpanel.yscroll set" \
-xscrollcommand ".ccpanel.xscroll set"
scrollbar .ccpanel.yscroll -command ".ccpanel.entries yview"
scrollbar .ccpanel.xscroll -orient horizontal \
-command ".ccpanel.entries xview"
button .ccpanel.but.ok -text OK -command {
global change
set change [selection get]
destroy .ccpanel
}
button .ccpanel.but.view -text "View Details" -command {
global branch
set chg ""
scan [selection get] "%d" chg
set details [aegis_get_change_details $branch $chg]
if {$details != ""} {
show_output "Change $chg" $details
}
}
button .ccpanel.but.cancel -text Cancel -command {
global change
set change ""
destroy .ccpanel
}
if {$cmd == "lc"} {
set changes [aegis_get_info_command "-l c -p $branch -unf"]
} else {
set changes [aegis_get_info_command "-$cmd -list -p $branch -unf"]
}
if {$changes == ""} {
destroy .ccpanel
return 0
}
scan $changes "%d" firstchange
set changes [split $changes "\n"]
foreach c $changes {
.ccpanel.entries insert end [lreplace $c 1 1 ":"]
incr cnt
}
pack .ccpanel.but .ccpanel.xscroll -side bottom -fill x
pack .ccpanel.entries -side left -fill x -expand true
pack .ccpanel.yscroll -side right -fill y
pack .ccpanel.but.ok .ccpanel.but.view .ccpanel.but.cancel \
-side left -fill x
if {$cnt == 0} {
destroy .ccpanel
show_message "Info" "No changes"
return 0
} elseif {$cnt == 1} {
destroy .ccpanel
set change $firstchange
if {$act != "" } {
show_message "Info" "Change $change autoselected for $act"
}
return 1
} else {
grab set .ccpanel
tkwait window .ccpanel
if {$change == ""} {
set change $oldchange
return 0
} else {
scan $change "%d" change
return 1
}
}
}
proc aegis_develop_begin {branch change} {
return [aegis_do_action_command "-db -p $branch -c $change"]
}
proc aegis_set_directory {branch change} {
cd [exec aegis -cd -p $branch -c $change -terse]
}
proc aegis_gen_diffs {branch change} {
return [aegis_do_action_command "-diff -p $branch -c $change"]
}
proc aegis_get_new_files {branch change} {
return [aegis_get_info_command "-nfu -list -p $branch -c $change -terse"]
}
proc aegis_get_old_files {branch change} {
return [aegis_get_info_command "-l pf -p $branch -c $change -terse"]
}
proc aegis_get_files {branch change} {
set files [aegis_get_new_files $branch $change]
append files " " [aegis_get_old_files $branch $change]
return $files
}
proc aegis_new_file {branch change fname} {
return [aegis_do_action_command "-nf $fname -p $branch -c $change"]
}
proc aegis_new_file_undo {branch change fname} {
return [aegis_do_action_command "-nfu $fname -p $branch -c $change"]
}
proc aegis_develop_end {branch change} {
return [aegis_do_action_command "-de -p $branch -c $change"]
}
proc aegis_develop_begin_undo {branch change} {
return [aegis_do_action_command "-dbu -p $branch -c $change"]
}
proc aegis_develop_end_undo {branch change} {
return [aegis_do_action_command "-deu -p $branch -c $change"]
}
proc aegis_get_removable_files {branch change} {
return [aegis_get_info_command "-rm -list -p $branch -c $change -terse"]
}
proc aegis_get_removable_undo_files {branch change} {
return [aegis_get_info_command "-rmu -list -p $branch -c $change -terse"]
}
proc aegis_remove_file {branch change fname} {
return [aegis_do_action_command "-rm $fname -p $branch -c $change"]
}
proc aegis_remove_file_undo {branch change fname} {
return [aegis_do_action_command "-rmu $fname -p $branch -c $change"]
}
proc aegis_get_copyable_files {branch change} {
return [aegis_get_info_command "-cp -list -p $branch -c $change -terse"]
}
proc aegis_get_copyable_undo_files {branch change} {
return [aegis_get_info_command "-cpu -list -p $branch -c $change -terse"]
}
proc aegis_copy_file {branch change fname} {
return [aegis_do_action_command "-cp $fname -p $branch -c $change"]
}
proc aegis_copy_file_undo {branch change fname} {
return [aegis_do_action_command "-cpu $fname -p $branch -c $change"]
}
proc aegis_build {branch change} {
return [aegis_do_action_command "-b -p $branch -c $change"]
}
proc aegis_new_test {branch change testfile} {
upvar $testfile rtn
set output [aegis_do_command "-nt -p $branch -c $change" code]
if {$code == 0} {
if [regexp {test/[0-9][0-9]/t[0-9]+[am]\.sh} $output rtn] {
set f [open $testfile w]
puts $f "#!/bin/sh"
puts $f "echo \"Test $testfile\""
puts $f {tmp=/tmp/$$}
puts $f "here=`pwd`"
puts $f {if [ $? -ne 0 ]; then exit 1; fi}
puts $f ""
puts $f "fail()"
puts $f "{"
puts $f " echo FAILED 1>&2"
puts $f { cd $here}
puts $f { rm -rf $tmp}
puts $f " exit 1"
puts $f "}"
puts $f ""
puts $f "pass()"
puts $f "{"
puts $f " echo \"$testfile PASSED\""
puts $f { cd $here}
puts $f { rm -rf $tmp}
puts $f " exit 0"
puts $f "}"
puts $f ""
puts $f "trap \"fail\" 1 2 3 15"
puts $f ""
puts $f {mkdir $tmp}
puts $f {if [ $? -ne 0 ]; then exit 1; fi}
puts $f {cd $tmp}
puts $f {if [ $? -ne 0 ]; then exit 1; fi}
puts $f ""
puts $f "# What we expect:"
puts $f "cat > test.ok << 'foo'"
puts $f "PUT YOUR COMMAND OUTPUT HERE"
puts $f "foo"
puts $f {if [ $? -ne 0 ]; then fail; fi}
puts $f ""
puts $f {$here/PUT_YOUR_COMMAND_HERE > test.out 2>&1}
puts $f "diff test.out test.ok"
puts $f {if [ $? -ne 0 ]; then fail; fi}
puts $f ""
puts $f "pass"
close $f
return 1
} else {
show_message "Warning" $output
}
} else {
show_message "Error" $output
}
return 0
}
proc aegis_get_new_test_files {branch change} {
return [aegis_get_info_command \
"-ntu -l -p $branch -c $change -terse | fgrep test"]
}
proc aegis_new_test_undo {branch change fname} {
return [aegis_do_action_command "-ntu $fname -p $branch -c $change"]
}
proc aegis_run_tests {branch change} {
return [aegis_do_action_command "-t -p $branch -c $change"]
}
proc aegis_run_regression_tests {branch change} {
return [aegis_do_action_command "-t -reg -p $branch -c $change"]
}
proc aegis_run_baseline_test {branch change} {
return [aegis_do_action_command "-t -bl -p $branch -c $change"]
}
proc aegis_review_pass {branch change} {
return [aegis_do_action_command "-rpass -p $branch -c $change"]
}
proc aegis_review_pass_undo {branch change} {
return [aegis_do_action_command "-rpu -p $branch -c $change"]
}
proc aegis_review_fail {branch change} {
return [aegis_do_action_command "-rfail -p $branch -c $change"]
}
proc aegis_integrate_begin {branch change} {
return [aegis_do_action_command "-ib -p $branch -c $change"]
}
proc aegis_integrate_begin_undo {branch change} {
return [aegis_do_action_command "-ibu -p $branch -c $change"]
}
proc aegis_integrate_pass {branch change} {
return [aegis_do_action_command "-ipass -p $branch -c $change"]
}
proc aegis_integrate_fail {branch change} {
return [aegis_do_action_command "-ifail -p $branch -c $change"]
}
proc aegis_show_diffs {branch change} {
global spawnwin
aegis_set_directory $branch $change
exec find . -name "*,D" -exec rm \{\} \;
if [aegis_gen_diffs $branch $change] {
foreach f [exec find . -name "*,D" -print | sort] {
set wn [join [split $f "./~,"] "_"]
set spawnwin($wn) .$wn
set txt [exec head -3 $f | tail -1]
if { $txt != "" && \
[string match "*TOTALS: 0 inserted 0 deleted*" $txt] == 0} {
show_text .$wn $f [exec cat $f]
}
}
}
}
proc aegis_trash_diffs {} {
global spawnwin
if [info exists spawnwin] {
foreach w [array names spawnwin] {
catch {destroy $spawnwin($w)}
}
unset spawnwin
}
}
######################################################################
# Some simple useful utilities
# Run an editor. First determine what editor to use. May need to wrap
# vi in an xterm???
if {$editor == ""} {
set editor $env(EDITOR)
if {$editor == ""} {
if [file exists /usr/local/bin/emacs"] {
set editor emacs
} else {
set editor /bin/vi
}
} else {
}
}
if {$editor == "/bin/vi"} {
set editor "xterm -fn 10x20 -e /bin/vi"
}
proc run_editor {files} {
global editor
eval exec $editor $files &
}
# Show some text in a text window
proc show_text {w title msg} {
toplevel $w
wm title $w $title
wm iconname $w "Aegis"
text $w.text -relief raised -bd 2 -yscrollcommand "$w.scroll set"
scrollbar $w.scroll -command "$w.text yview"
button $w.button -text "OK" -command "destroy $w"
pack $w.button -side bottom -padx 10 -pady 10
pack $w.scroll -side right -fill y
pack $w.text -side left
bind $w.button <Return> "destroy $w"
$w.text insert end $msg
}
# Show some text and wait for the text widget to be closed
proc show_output {title msg} {
catch { destroy .info }
show_text .info $title $msg
focus .info.button
grab set .info
tkwait window .info
}
# Similar to above but using a message widget
proc show_message {title msg} {
catch { destroy .info }
toplevel .info
wm title .info $title
wm iconname .info "Aegis"
message .info.msg -text $msg -just center -aspect 300
pack .info.msg -side top -padx 10 -pady 10
button .info.button -text "OK" -command "destroy .info"
pack .info.button -side bottom -padx 10 -pady 10
bind .info.button <Return> "destroy .info"
focus .info.button
grab set .info
tkwait window .info
}
# Convert numeric boolean values to symbolic and vice-versa
proc booltonum {var} {
if {$var == "true" } {
return 1
} elseif {$var == "false" } {
return 0
} else {
return $var
}
}
proc numtobool {var} {
if {$var == 1 } {
return "true"
} elseif {$var == 0 } {
return "false"
} else {
return $var
}
}
# Show a message for functionality not yet implemented
proc not_implemented {} {
show_message "No way Jose" \
"Work in progress\nFunction not yet implemented"
}
# Message for Help-About
proc about_tkaegis {} {
show_message "About tkaegis" \
"tkaegis v1.2\nby Graham Wheeler\ngram@cdsec.com\n\
(C) 1999, All Rights Reserved"
}
# Get confirmation for an action
proc get_confirm {msg} {
global cnf
toplevel .panel
wm title .panel "Confirm Action"
frame .panel.top
frame .panel.bottom
label .panel.top.label -text $msg
button .panel.bottom.ok -text OK -command { destroy .panel; set cnf 1 }
button .panel.bottom.cancel -text Cancel \
-command { destroy .panel; set cnf 0 }
pack .panel.top -side top
pack .panel.bottom -side bottom
pack .panel.top.label -side left -fill x
pack .panel.bottom.cancel -side right -fill y
pack .panel.bottom.ok -side left -fill y
grab set .panel
focus .panel.bottom.ok
bind .panel.bottom.ok <Return> {
destroy .panel
set cnf 1
}
tkwait window .panel
if {$cnf == 1} { return 1} else { return 0}
}
proc choose_files {title files} {
global change scratch
set cnt 0
set scratch ""
toplevel .cfpanel
wm title .cfpanel $title
frame .cfpanel.but
label .cfpanel.chosen -text ""
listbox .cfpanel.entries -relief raised -borderwidth 2 \
-yscrollcommand ".cfpanel.scroll set"
scrollbar .cfpanel.scroll -command ".cfpanel.entries yview"
button .cfpanel.but.clear -text Clear -command {
global scratch
set scratch ""
.cfpanel.chosen config -text $scratch
}
button .cfpanel.but.add -text Include -command {
global scratch
append scratch [selection get] " "
.cfpanel.chosen config -text $scratch
}
button .cfpanel.but.ok -text Done -command {
destroy .cfpanel
}
button .cfpanel.but.cancel -text Cancel -command {
global scratch
set scratch ""
destroy .cfpanel
}
foreach f $files {
.cfpanel.entries insert end $f
incr cnt
}
pack .cfpanel.chosen .cfpanel.but -side bottom -fill x
pack .cfpanel.entries -side left -fill x -expand true
pack .cfpanel.scroll -side right -fill y
pack .cfpanel.but.clear .cfpanel.but.add .cfpanel.but.ok \
.cfpanel.but.cancel -side left -fill x
if {$cnt == 0} {
destroy .cfpanel
show_message "Info" "No files"
return ""
} else {
grab set .cfpanel
tkwait window .cfpanel
return $scratch
}
}
proc select_change {cmd {act ""} } {
global branch change
# If the change is already set, make sure that we can apply the
# current action to it. If not, give an error.
if {$change != ""} {
set ok 0
set changes [aegis_get_info_command "-$cmd -list -p $branch -unf"]
set changes [split $changes "\n"]
foreach c $changes {
scan $c "%d" cnum
if {$cnum == $change} {
set ok 1
break
}
}
if {$ok == 0} {
show_message "Error" \
"Action not applicable to current selected change $change"
if [get_confirm "Select a different change?"] {
set change ""
} else {
return 0
}
}
}
if {$change == ""} {
aegis_choose_change $act $cmd
} elseif {$act != ""} {
if {[get_confirm "Change $change: do you want to $act?"] == 0} {
set change ""
}
}
if {$change == ""} {
show_message "Info" "No selected or applicable change"
return 0
} else {
return 1
}
}
######################################################################
# Main variables
set mode "none"
set proj ""
set branch ""
set directory ""
set change ""
set user [exec whoami]
# If projbasedir isn't set explicitly, use the $HOME directory:
if {$projbasedir == ""} {
set projbasedir $env(HOME)
}
trace variable proj w change_project
trace variable branch w change_branch
set scratch ""
set cnf 0
# Project attributes
set pdescription ""
set powner ""
set pgroup ""
set pumask ""
set devmayrev ""
set devmayint ""
set revmayint ""
set devmaychg ""
set deftestexempt ""
set presidue ""
# Change attributes
set ctitle ""
set cdescription ""
set ccause ""
set ctestexempt ""
set cblexempt ""
set cregexempt ""
set cresidue ""
########################################################################
# Create the main menu
frame .mbar -relief raised -bd 2
frame .work -height 5c -width 10c
text .work.status -yscrollcommand { .work.scroll set}
scrollbar .work.scroll -command {.work.status yview}
menubutton .mbar.help -text Help -underline 0 -menu .mbar.help.menu
pack .mbar.help -side right
pack .work.scroll -side right -fill y
pack .work.status -side left -fill both -expand true
pack .mbar .work -side top -fill x
########################################################################
# Create the `Help' drop-down menu. This is always present; all other menus
# are created and destroyed dynamically.
#
# TODO: Actually add some help here!
menu .mbar.help.menu -tearoff 0
.mbar.help.menu add command -label "About" -command about_tkaegis
# Some utilities for building the menus
proc AddMainMenuItem {nm lbl} {
menubutton ".mbar.$nm" -text $lbl -underline 0 -menu ".mbar.${nm}.menu"
pack ".mbar.$nm" -side left
menu ".mbar.${nm}.menu" -tearoff 0
}
proc DestroyMainMenuItem {nm} {
if [winfo exists .mbar.$nm] { destroy .mbar.$nm }
}
proc AddDropDownMenuCommand {nm lbl act} {
".mbar.${nm}.menu" add command -label $lbl -command $act
}
proc AddDropDownMenuRadioButton {nm lbl var val} {
global $var
".mbar.${nm}.menu" add radiobutton -label $lbl -variable $var -value $val
}
proc AddDropDownMenuCascade {nm lbl sub} {
".mbar.${nm}.menu" add cascade -label $lbl -menu ".mbar.${nm}.menu.$sub"
menu ".mbar.${nm}.menu.$sub" -tearoff 0
}
proc AddCascadeCommand {nm sub lbl cmd} {
".mbar.${nm}.menu.$sub" add command -label $lbl -command $cmd
}
proc AddDropDownMenuSeparator {nm} {
".mbar.${nm}.menu" add separator
}
########################################################################
# The Project Menu. Handles project creation. selection and deletion
# Does not handle branches. Projects can be deleted by selecting them,
# after which a Delete Project option will appear if the user has the
# authority to delete the project.
proc add_project_menu {} {
global proj user
AddMainMenuItem project Project
AddDropDownMenuCommand project "New Project" new_project
AddStatusLine "Getting active project list"
set projects [aegis_get_core_projects]
if {$projects != ""} {
AddDropDownMenuSeparator project
foreach p $projects {
AddDropDownMenuRadioButton project $p proj $p
}
}
if {$proj != "" && [aegis_has_role a $user $proj]} {
AddDropDownMenuSeparator project
AddDropDownMenuCommand project "Delete Project" delete_project
}
AddDropDownMenuSeparator project
AddDropDownMenuCommand project "Clear Status" ClearStatus
AddDropDownMenuSeparator project
AddDropDownMenuCommand project Quit exit
}
proc update_project {} {
global proj branch
AddStatusLine "Selecting project $proj"
remove_role_menu
remove_branch_menu
remove_project_menu
add_project_menu
if {$proj != ""} {
add_branch_menu
if {$branch != ""} {
add_role_menu
}
}
}
proc change_project {name element op} {
update_project
}
set initvers ""
proc new_project {} {
global proj branch directory initvers
trace vdelete proj w change_project
trace vdelete branch w change_branch
set old_name $proj
set old_branch $branch
set old_directory $directory
set proj ""
set branch ""
set directory ""
toplevel .panel
wm title .panel "New Project"
frame .panel.name
label .panel.name.namelabel -text "Name:"
entry .panel.name.nameentry -width 20 -relief sunken -bd 2 \
-textvariable proj
bind .panel.name.nameentry <Return> {
focus .panel.vers.versentry
}
frame .panel.vers
label .panel.vers.verslabel -text "Initial Version:"
entry .panel.vers.versentry -width 20 -relief sunken -bd 2 \
-textvariable initvers
bind .panel.vers.versentry <Return> {
focus .panel.dir.direntry
}
frame .panel.dir
label .panel.dir.dirlabel -text "Directory:"
entry .panel.dir.direntry -width 20 -relief sunken -bd 2 \
-textvariable directory
bind .panel.dir.direntry <Return> {
focus .panel.buts.ok
}
frame .panel.buts
button .panel.buts.ok -text OK -command {
destroy .panel
}
bind .panel.buts.ok <Return> {
destroy .panel
}
button .panel.buts.cancel -text Cancel -command {
set proj ""
destroy .panel
}
bind .panel.buts.cancel <Return> {
set proj ""
destroy .panel
}
pack .panel.name .panel.vers .panel.dir -side top
pack .panel.buts -side bottom
pack .panel.name.namelabel .panel.name.nameentry -side left \
-padx 1m -pady 2m -fill x
pack .panel.vers.verslabel .panel.vers.versentry -side left \
-padx 1m -pady 2m -fill x
pack .panel.dir.dirlabel .panel.dir.direntry -side left \
-padx 1m -pady 2m -fill x
pack .panel.buts.cancel -side right -fill y
pack .panel.buts.ok -side left -fill y
focus .panel.name.nameentry
grab set .panel
tkwait window .panel
if {$proj != ""} {
set msg ""
if [aegis_new_project $proj $initvers $directory] {
update_project
} else {
set proj $old_name
set branch $old_branch
set directory $old_directory
}
} else {
set proj $old_name
set branch $old_branch
set directory $old_directory
}
trace variable proj w change_project
trace variable branch w change_branch
}
proc delete_project {} {
global proj branch directory
if [aegis_delete_project $proj] {
set proj ""
set branch ""
set directory ""
} else {
AddStatusLine "Deletion of project $proj incomplete"
}
}
proc remove_project_menu {} {
DestroyMainMenuItem project
}
########################################################################
# The Branch Menu
#
# Show the open branches associated with the active project, and allow
# the user to select which one they want, delete a selected branch,
# or create a new branch.
proc add_branch_menu {} {
global proj user branch
AddMainMenuItem vers Branch
AddDropDownMenuCommand vers "New Branch" new_branch
set branches [aegis_get_branches $proj]
if {$branches != ""} {
AddDropDownMenuSeparator vers
foreach b $branches {
AddDropDownMenuRadioButton vers $b branch $b
}
}
if {$branch != "" && [aegis_has_role a $user $proj]} {
AddDropDownMenuSeparator vers
AddDropDownMenuCommand vers "Delete Branch" delete_branch
}
}
proc update_branch {} {
global proj branch
AddStatusLine "Selecting project $proj branch $branch"
remove_role_menu
remove_branch_menu
if {$proj != ""} {
add_branch_menu
if {$branch != ""} {
add_role_menu
}
}
}
proc change_branch {name element op} {
update_branch
}
proc new_branch {} {
global proj branch directory initvers
trace vdelete branch w change_branch
set old_branch $branch
set old_directory $directory
set branch ""
set directory ""
set initvers ""
toplevel .panel
wm title .panel "New Branch"
frame .panel.name
label .panel.name.namelabel -text "Branch Number:"
entry .panel.name.nameentry -width 20 -relief sunken -bd 2 \
-textvariable initvers
bind .panel.name.nameentry <Return> {
focus .panel.dir.direntry
}
frame .panel.dir
label .panel.dir.dirlabel -text "Directory:"
entry .panel.dir.direntry -width 20 -relief sunken -bd 2 \
-textvariable directory
bind .panel.dir.direntry <Return> {
focus .panel.buts.ok
}
frame .panel.buts
button .panel.buts.ok -text OK -command {
destroy .panel
}
bind .panel.buts.ok <Return> {
destroy .panel
}
button .panel.buts.cancel -text Cancel -command {
set proj ""
destroy .panel
}
bind .panel.buts.cancel <Return> {
set proj ""
destroy .panel
}
pack .panel.name .panel.dir -side top
pack .panel.buts -side bottom
pack .panel.name.namelabel .panel.name.nameentry -side left \
-padx 1m -pady 2m -fill x
pack .panel.dir.dirlabel .panel.dir.direntry -side left \
-padx 1m -pady 2m -fill x
pack .panel.buts.cancel -side right -fill y
pack .panel.buts.ok -side left -fill y
focus .panel.name.nameentry
grab set .panel
tkwait window .panel
if {$initvers != ""} {
AddStatusLine "Creating branch $proj.$initvers"
set msg ""
if [aegis_new_branch "$proj.$initvers" $directory] {
update_branch
} else {
set branch $old_branch
set directory $old_directory
}
} else {
set branch $old_branch
set directory $old_directory
}
trace variable branch w change_branch
}
proc delete_branch {} {
global proj branch directory
if [aegis_delete_branch $branch] {
set branch ""
} else {
AddStatusLine "Deletion of branch $branch incomplete"
}
}
proc remove_branch_menu {} {
DestroyMainMenuItem vers
}
########################################################################
# The Role Menu
proc add_role_to_menu {proj user role mnu tag cmd} {
if [aegis_has_role $role $user $proj] {
AddDropDownMenuCommand $mnu $tag $cmd
}
}
proc add_role_menu {} {
global user branch
AddMainMenuItem role Role
add_role_to_menu $branch $user a role Administrate enter_administrate_mode
add_role_to_menu $branch $user d role Develop enter_develop_mode
add_role_to_menu $branch $user r role Review enter_review_mode
add_role_to_menu $branch $user i role Integrate enter_integrate_mode
}
proc update_roles {} {
remove_role_menu
add_role_menu
}
proc remove_role_menu {} {
leave_mode
DestroyMainMenuItem role
}
#######################
# ADMINISTRATION MODE #
#######################
proc enter_administrate_mode {} {
global mode user proj branch
leave_mode
set mode "administrate"
AddMainMenuItem admin Admin
# AddDropDownMenuCommand admin "New Project Release" command_not_implemented
AddDropDownMenuCommand admin "Edit Branch Attributes" \
edit_branch_attributes
AddMainMenuItem staff Staff
AddDropDownMenuCascade staff "Administrators" administrators
AddCascadeCommand staff administrators "Add" add_administrators
AddCascadeCommand staff administrators "View" view_administrators
AddCascadeCommand staff administrators "Remove" remove_administrators
AddDropDownMenuCascade staff "Developers" developers
AddCascadeCommand staff developers "Add" add_developers
AddCascadeCommand staff developers "View" view_developers
AddCascadeCommand staff developers "Remove" remove_developers
AddDropDownMenuCascade staff "Reviewers" reviewers
AddCascadeCommand staff reviewers "Add" add_reviewers
AddCascadeCommand staff reviewers "View" view_reviewers
AddCascadeCommand staff reviewers "Remove" remove_reviewers
AddDropDownMenuCascade staff "Integrators" integrators
AddCascadeCommand staff integrators "Add" add_integrators
AddCascadeCommand staff integrators "View" view_integrators
AddCascadeCommand staff integrators "Remove" remove_integrators
AddMainMenuItem change Change
AddDropDownMenuCommand change "Add New Change" add_new_change
AddDropDownMenuCommand change "New Change Undo" new_change_undo
AddDropDownMenuCommand change "Edit Change Attributes" \
modify_change_attributes
AddDropDownMenuCommand change "View Changes" view_changes
}
proc fetch_branch_attributes {} {
global branch pdescription powner pgroup pumask presidue
global devmayrev devmayint revmayint devmaychg deftestexempt
set presidue ""
set lines [aegis_get_project_attributes $branch]
if {$lines != ""} {
set lines [split $lines "\n"]
foreach l $lines {
set flds [split $l "="]
set opt [string trim [lindex $flds 0] " \t\"{};"]
set val [string trim [lindex $flds 1] " \t\"{};"]
set val [booltonum $val]
if {$opt == "description"} {
set pdescription $val
} elseif {$opt == "owner_name"} {
set powner $val
} elseif {$opt == "group_name"} {
set pgroup $val
} elseif {$opt == "developer_may_review"} {
set devmayrev $val
} elseif {$opt == "developer_may_integrate"} {
set devmayint $val
} elseif {$opt == "reviewer_may_integrate"} {
set revmayint $val
} elseif {$opt == "developers_may_create_changes"} {
set devmaychg $val
} elseif {$opt == "umask"} {
set pumask $val
} elseif {$opt == "default_test_exemption"} {
set deftestexempt $val
} else {
append presidue $l "\n"
}
}
} else {
show_message "Error" $lines
}
}
proc edit_branch_attributes {} {
global branch pdescription pumask presidue
global devmayrev devmayint revmayint devmaychg deftestexempt
fetch_branch_attributes
toplevel .panel
wm title .panel "Edit Branch Attributes"
frame .panel.desc
frame .panel.options1
frame .panel.options2
frame .panel.options3
frame .panel.options4
frame .panel.options5
frame .panel.bottom
label .panel.desc.label -text "Description:"
entry .panel.desc.entry -width 20 -relief sunken -bd 2 \
-textvariable pdescription
checkbutton .panel.options1.devmayrev -text "Developer may review" \
-variable devmayrev
checkbutton .panel.options2.devmayint -text "Developer may integrate" \
-variable devmayint
checkbutton .panel.options3.revmayint -text "Reviewer may integrate" \
-variable revmayint
checkbutton .panel.options4.devmaychg -text "Developer may create changes" \
-variable devmaychg
checkbutton .panel.options5.deftestexempt -text "Default test exempt" \
-variable deftestexempt
button .panel.bottom.ok -text OK -command { destroy .panel }
button .panel.bottom.cancel -text Cancel -command {
set pdescription "X";destroy .panel
}
pack .panel.desc .panel.options1 .panel.options2 \
.panel.options3 .panel.options4 .panel.options5 .panel.bottom \
-side top -fill x
pack .panel.desc.label .panel.desc.entry -side left -pady 2m -fill x
pack .panel.options1.devmayrev -side left
pack .panel.options2.devmayint -side left
pack .panel.options3.revmayint -side left
pack .panel.options4.devmaychg -side left
pack .panel.options5.deftestexempt -side left
pack .panel.bottom.cancel -side right -fill y
pack .panel.bottom.ok -side left -fill y
grab set .panel
tkwait window .panel
if {$pdescription != "X"} {
set devmayrev [numtobool $devmayrev]
set devmayint [numtobool $devmayint]
set revmayint [numtobool $revmayint]
set devmayrev [numtobool $devmayrev]
set devmaychg [numtobool $devmaychg]
set deftestexempt [numtobool $deftestexempt]
set fname "/tmp/$branch.pattr"
set f [open $fname w]
puts $f "description = \"$pdescription\";"
puts $f "developer_may_review = $devmayrev;"
puts $f "developer_may_integrate = $devmayint;"
puts $f "reviewer_may_integrate = $revmayint;"
puts $f "developers_may_create_changes = $devmaychg;"
puts $f "umask = $pumask;"
puts $f "default_test_exemption = $deftestexempt;"
puts $f $presidue
close $f
aegis_set_project_attributes $branch $fname
exec rm $fname
}
}
# Useful common code for applying aegis commands to user names selected from
# a list.
set list_action ""
proc apply_list_action {} {
global list_action mode user branch
if {$list_action != ""} {
exec aegis $list_action [selection get] -p $branch
foreach el [selection get] {
if {$user == $el} {
set tmp $mode
leave_mode
update_roles
enter_mode $tmp
destroy .panel
break;
}
}
}
}
proc do_list {list cmd title} {
global branch list_action
set list_action $cmd
toplevel .panel
wm title .panel $title
frame .panel.but
pack .panel.but -side bottom
listbox .panel.entries -relief raised -borderwidth 2 \
-yscrollcommand ".panel.scroll set"
pack .panel.entries -side left
scrollbar .panel.scroll -command ".panel.entries yview"
pack .panel.scroll -side right -fill y
if {$list_action != ""} {
button .panel.but.ok -text OK -command apply_list_action
bind .panel.but.ok <Return> {
apply_list_action
}
button .panel.but.cancel -text Cancel -command { destroy .panel }
} else {
button .panel.but.cancel -text Done -command { destroy .panel }
}
focus .panel.but.cancel
bind .panel.but.cancel <Return> {
destroy .panel
}
if {$list_action != ""} {
pack .panel.but.ok .panel.but.cancel -side left -fill x
} else {
pack .panel.but.cancel -side left -fill x
}
foreach f $list {
.panel.entries insert end $f
}
grab set .panel
tkwait window .panel
}
proc view_roleplayers {who typcode} {
global branch
set roleplayers [aegis_get_roleplayers $branch $typcode]
if {$roleplayers != ""} {do_list $roleplayers "" "View $who"}
}
proc add_roleplayers {who typcode} {
set users [aegis_get_possible_roleplayers]
if {$users != ""} {
do_list $users "-n$typcode" "Add $who"
}
}
proc remove_roleplayers {who typcode} {
global branch
set roleplayers [aegis_get_roleplayers $branch $typcode]
if {$roleplayers != ""} {do_list $roleplayers "-r$typcode" "Remove $who"}
}
proc view_administrators {} {
view_roleplayers Administrators a
}
proc view_developers {} {
view_roleplayers Developers d
}
proc view_reviewers {} {
view_roleplayers Reviewers rev
}
proc view_integrators {} {
view_roleplayers Integrators i
}
proc add_administrators {} {
add_roleplayers Administrators a
}
proc add_developers {} {
add_roleplayers Developers d
}
proc add_reviewers {} {
add_roleplayers Reviewers rev
}
proc add_integrators {} {
add_roleplayers Integrators i
}
proc remove_administrators {} {
remove_roleplayers Administrators a
}
proc remove_developers {} {
remove_roleplayers Developers d
}
proc remove_reviewers {} {
remove_roleplayers Reviewers rev
}
proc remove_integrators {} {
remove_roleplayers Integrators i
}
proc fetch_change_attributes {} {
global branch change cresidue
global ctitle cdescription ccause ctestexempt cblexempt cregexempt
set cresidue ""
set lines [aegis_get_change_attributes $branch $change]
if {$lines != ""} {
set lines [split $lines "\n"]
foreach l $lines {
set flds [split $l "="]
set opt [string trim [lindex $flds 0] " \t\"{};"]
set val [string trim [lindex $flds 1] " \t\"{};"]
set val [booltonum $val]
if {$opt == "brief_description"} {
set ctitle $val
} elseif {$opt == "description"} {
set cdescription $val
} elseif {$opt == "cause"} {
set ccause $val
} elseif {$opt == "test_exempt"} {
set ctestexempt $val
} elseif {$opt == "test_baseline_exempt"} {
set cblexempt $val
} elseif {$opt == "regression_test_exempt"} {
set cregexempt $val
} else {
append cresidue $l "\n"
}
}
} else {
show_message "Error" $lines
}
}
proc edit_change_attributes {title fname} {
global change cresidue
global ctitle cdescription ccause ctestexempt cblexempt cregexempt
toplevel .panel
wm title .panel $title
frame .panel.title
frame .panel.desc
frame .panel.cause1
frame .panel.cause2
frame .panel.opts
frame .panel.bottom
pack .panel.bottom -side bottom -fill x
pack .panel.title .panel.desc .panel.cause1 .panel.cause2 .panel.opts \
-side top -fill x
label .panel.title.lbl -text "Title:"
entry .panel.title.desc -width 20 -relief sunken -bd 2 -textvariable ctitle
pack .panel.title.lbl .panel.title.desc -side left -fill x -expand true
label .panel.desc.lbl -text "Description"
entry .panel.desc.text -width 20 -relief sunken -bd 2 \
-textvariable cdescription
pack .panel.desc.lbl .panel.desc.text -side left -fill x -expand true
radiobutton .panel.cause1.ie -text "Enhancement (internal)" \
-variable ccause -value "internal_enhancement"
radiobutton .panel.cause1.ii -text "Improvement (internal)" \
-variable ccause -value "internal_improvement"
radiobutton .panel.cause1.ib -text "Bug Repair (internal)" \
-variable ccause -value "internal_bug"
radiobutton .panel.cause2.ee -text "Enhancement (external)" \
-variable ccause -value "external_enhancement"
radiobutton .panel.cause2.ei -text "Improvement (external)" \
-variable ccause -value "external_improvement"
radiobutton .panel.cause2.eb -text "Bug Repair (external)" \
-variable ccause -value "external_bug"
pack .panel.cause1.ie .panel.cause1.ii .panel.cause1.ib -side left -fill x
pack .panel.cause2.ee .panel.cause2.ei .panel.cause2.eb -side left -fill x
checkbutton .panel.opts.tx -text "New Test Exempt"\
-variable ctestexempt
checkbutton .panel.opts.bx -text "Baseline Test Exempt"\
-variable cblexempt
checkbutton .panel.opts.rx -text "Regression Test Exempt"\
-variable cregexempt
pack .panel.opts.tx .panel.opts.bx .panel.opts.rx -side left -fill x
button .panel.bottom.ok -text OK -command {
destroy .panel
}
button .panel.bottom.cancel -text Cancel -command {
global ctitle; set ctitle ""; destroy .panel }
pack .panel.bottom.cancel -side right -fill y
pack .panel.bottom.ok -side left -fill y
grab set .panel
tkwait window .panel
if {$ctitle != ""} {
set ctestexempt [numtobool $ctestexempt]
set cblexempt [numtobool $cblexempt]
set cregexempt [numtobool $cregexempt]
set f [open $fname w]
puts $f "brief_description = \"$ctitle\";"
puts $f "description = \"$cdescription\";"
puts $f "cause = $ccause;"
puts $f "test_exempt = $ctestexempt;"
puts $f "test_baseline_exempt = $cblexempt;"
puts $f "regression_test_exempt = $cregexempt;"
puts $f $cresidue
close $f
return 1
}
return 0
}
proc add_new_change {} {
global branch cresidue arch
global ctitle cdescription ccause ctestexempt cblexempt cregexempt
set ctitle "Untitled"
set cdescription "Undescribed"
set ccause internal_enhancement
set ctestexempt 0
set cblexempt 0
set cregexempt 1
set cresidue "architecture =\n\[\n\t\"$arch\",\n\];\n"
set fname "/tmp/$branch.cattr"
if [edit_change_attributes "New Change" $fname] {
aegis_create_new_change $branch $fname
exec rm $fname
}
}
proc new_change_undo {} {
global branch change
if [select_change "ncu" "cancel"] {
aegis_new_change_undo $branch $change
set change ""
}
}
proc view_changes {} {
global branch
set changelog [aegis_get_changelog $branch]
if {$changelog != ""} {
show_output "Change History" $changelog
} else {
show_message "Change History" "No changes"
}
}
proc modify_change_attributes {} {
global branch change
if [select_change "lc"] {
fetch_change_attributes
set fname "/tmp/$branch.cattr"
if [edit_change_attributes "Edit Attributes" $fname] {
aegis_set_change_attributes $branch $change $fname
exec rm $fname
}
}
}
proc leave_administrate_mode {} {
DestroyMainMenuItem change
DestroyMainMenuItem staff
DestroyMainMenuItem admin
}
################
# DEVELOP MODE #
################
set has_develop_menus 0
proc enter_develop_mode {} {
global mode user branch
if {[aegis_has_role d $user $branch]} {
leave_mode
set mode "develop"
AddMainMenuItem develop Develop
AddDropDownMenuCommand develop "View Changes" view_changes
AddDropDownMenuCommand develop "Begin Change" develop_begin
AddDropDownMenuCommand develop "Continue Change" develop_continue
AddDropDownMenuCommand develop "View Differences" view_diffs
AddDropDownMenuCommand develop "Abort Change" develop_begin_undo
AddDropDownMenuCommand develop "End Change" develop_end
AddDropDownMenuCommand develop "Resume Change" develop_end_undo
}
}
proc add_develop_menus {} {
global has_develop_menus
if {$has_develop_menus == 0} {
set has_develop_menus 1
AddMainMenuItem file File
AddDropDownMenuCommand file "Edit Files" edit_files
AddDropDownMenuCommand file "Add New File" new_file
AddDropDownMenuCommand file "Discard New File" new_file_undo
AddDropDownMenuCommand file "Remove Existing File" remove_file
AddDropDownMenuCommand file "Restore Existing File" remove_file_undo
AddDropDownMenuCommand file "Change Existing File" copy_file
AddDropDownMenuCommand file "Undo Changes to Existing File" \
copy_file_undo
AddMainMenuItem build Build
AddDropDownMenuCommand build "Build Project" build_project
AddMainMenuItem test Test
AddDropDownMenuCommand test "Add New Test Script" new_test
AddDropDownMenuCommand test "Discard New Test Script" new_test_undo
AddDropDownMenuSeparator test
AddDropDownMenuCommand test "Run New Tests" run_tests
AddDropDownMenuCommand test "Run Regression Tests" \
run_regression_tests
AddDropDownMenuCommand test "Run Baseline Test" run_baseline_test
}
}
proc develop_begin {} {
global branch change
if [select_change "db" "develop" ] {
if [aegis_develop_begin $branch $change] {
AddStatusLine "Developing change $change of project $branch"
aegis_set_directory $branch $change
if {! [file exists config] } {
make_templates
}
}
add_develop_menus
}
}
proc develop_continue {} {
global branch change
if [select_change "de" "continue developing"] {
aegis_set_directory $branch $change
add_develop_menus
}
}
proc view_diffs {} {
global branch change
if [select_change "de" "view diffs" ] {
aegis_show_diffs $branch $change
}
}
proc edit_files {} {
global branch change
set files [aegis_get_files $branch $change]
if {$files != ""} {
set files [choose_files "Select files to edit" $files]
if {$files != ""} {
run_editor $files
}
}
}
proc develop_end {} {
global branch change
if [aegis_develop_end $branch $change] {
remove_develop_menus
}
}
proc develop_begin_undo {} {
global branch change
if [select_change "dbu" "undo develop begin"] {
if [get_confirm "Cancel development (all changes will be lost)?"] {
if [aegis_develop_begin_undo $branch $change] {
remove_develop_menus
}
}
}
}
proc develop_end_undo {} {
global branch change
if [select_change "deu" "undo develop end"] {
if [aegis_develop_end_undo $branch $change] {
AddStatusLine "Developing change $change of project $branch"
}
}
}
proc new_file {} {
global branch change scratch
toplevel .panel
set scratch ""
wm title .panel "New File"
frame .panel.top
frame .panel.bottom
label .panel.top.label -text "File name:"
entry .panel.top.entry -width 20 -relief sunken -bd 2 -textvariable scratch
button .panel.bottom.ok -text OK -command { destroy .panel }
button .panel.bottom.cancel -text Cancel \
-command { set scratch "";destroy .panel }
pack .panel.top -side top
pack .panel.bottom -side bottom
pack .panel.top.label .panel.top.entry -side left -padx 1m -pady 2m \
-fill x
pack .panel.bottom.cancel -side right -fill y
pack .panel.bottom.ok -side left -fill y
focus .panel.top.entry
grab set .panel
tkwait window .panel
if {$scratch != ""} {
aegis_new_file $branch $change $scratch
}
}
proc new_file_undo {} {
global branch change
set files [aegis_get_new_files $branch $change]
if {$files != ""} {
set f [choose_files "Files to Remove" $files]
if {$f != "" } {
if [get_confirm "Remove file $f from project?"] {
aegis_new_file_undo $branch $change $f
}
}
}
}
proc remove_file {} {
global branch change
set files [aegis_get_removable_files $branch $change]
if {$files != ""} {
set f [choose_files "Files to Remove" $files]
if {$f != "" } {
if [get_confirm "Remove file $f from project?"] {
aegis_remove_file $branch $change $f
}
}
}
}
proc remove_file_undo {} {
global branch change
set files [aegis_get_removable_undo_files $branch $change]
if {$files != ""} {
set f [choose_files "Files to Undo Remove" $files]
if {$f != "" } {
if [get_confirm "Restore file $f to project?"] {
aegis_remove_file_undo $branch $change $f
}
}
}
}
proc copy_file {} {
global branch change
set files [aegis_get_copyable_files $branch $change]
if {$files != ""} {
set f [choose_files "Files to Change" $files]
if {$f != "" } {
aegis_copy_file $branch $change $f
}
}
}
proc copy_file_undo {} {
global branch change
set files [aegis_get_copyable_undo_files $branch $change]
if {$files != ""} {
set f [choose_files "Files to Undo Changes" $files]
if {$f != "" } {
if [get_confirm "Undo changes to $f?"] {
aegis_copy_file_undo $branch $change $f
}
}
}
}
# make_templates is intended to make makefile/cookfile and config
# file templates upon first change
proc make_templates {} {
show_message "Sorry!" "Templates not implemented yet!"
}
proc build_project {} {
global branch change
if [winfo exists .build] { destroy .build }
if [aegis_build $branch $change] {
show_message "Info" "Build successful!"
} else {
show_text .build "Build Failed" [exec cat aegis.log]
}
}
proc new_test {} {
global branch change
if [aegis_new_test $branch $change testfile] {
run_editor $testfile
}
}
proc new_test_undo {} {
global branch change
set files [aegis_get_new_test_files $branch $change]
if {$files != ""} {
set f [choose_files "Tests to Remove" $files ]
if {$f != "" } {
aegis_new_test_undo $branch $change $f
}
}
}
proc run_tests {} {
global branch change
if [winfo exists .test] { destroy .test }
if [aegis_run_tests $branch $change] {
show_message "Info" "Change passed tests"
} else {
show_text .test "Error" [exec cat aegis.log]
}
}
proc run_regression_tests {} {
global branch change
if [winfo exists .regtest] { destroy .regtest }
if [aegis_run_regression_tests $branch $change] {
show_message "Info" "Change passed regression tests"
} else {
show_text .regtest "Error" [exec cat aegis.log]
}
}
proc run_baseline_test {} {
global branch change
if [winfo exists .bltest] { destroy .bltest }
if [aegis_run_baseline_test $branch $change] {
show_message "Info" "Change passed baseline test"
} else {
show_text .bl_test "Error" [exec cat aegis.log]
}
}
proc remove_develop_menus {} {
global has_develop_menus
if {$has_develop_menus} {
set has_develop_menus 0
DestroyMainMenuItem test
DestroyMainMenuItem build
DestroyMainMenuItem file
}
}
proc leave_develop_mode {} {
remove_develop_menus
DestroyMainMenuItem develop
}
###############
# REVIEW MODE #
###############
proc enter_review_mode {} {
global mode user branch
if {[aegis_has_role r $user $branch] == 1} {
leave_mode
set mode "review"
AddMainMenuItem review Review
AddDropDownMenuCommand review "View Changes" view_changes
AddDropDownMenuSeparator review
AddDropDownMenuCommand review "Begin Review" review_change
AddDropDownMenuCommand review "Abort Review" review_abort
AddDropDownMenuSeparator review
AddDropDownMenuCommand review "Pass" review_pass
AddDropDownMenuCommand review "Fail" review_fail
AddDropDownMenuCommand review "Undo Pass" review_pass_undo
}
}
proc review_change {} {
global branch change
if [select_change "rpass" "review" ] {
aegis_show_diffs $branch $change
}
}
proc review_abort {} {
global change
aegis_trash_diffs
set change ""
}
proc review_pass {} {
global branch change
if [select_change "rpass" "pass review"] {
aegis_review_pass $branch $change
aegis_trash_diffs
}
}
proc review_fail {} {
global branch change
if [select_change "rfail" "fail review"] {
aegis_review_fail $branch $change
aegis_trash_diffs
}
}
proc review_pass_undo {} {
global branch change
if [select_change "rpu" "undo review"] {
aegis_review_pass_undo $branch $change
aegis_trash_diffs
}
}
proc leave_review_mode {} {
DestroyMainMenuItem review
}
##################
# INTEGRATE MODE #
##################
proc enter_integrate_mode {} {
global mode user branch
if {[aegis_has_role i $user $branch] == 1} {
leave_mode
set mode "integrate"
AddMainMenuItem integrate Integrate
AddDropDownMenuCommand integrate "View Changes" view_changes
AddDropDownMenuSeparator integrate
AddDropDownMenuCommand integrate "Start Integration" integrate_begin
AddDropDownMenuCommand integrate "Resume Integration" integrate_resume
AddDropDownMenuCommand integrate "Cancel Integration" \
integrate_begin_undo
AddDropDownMenuSeparator integrate
AddDropDownMenuCommand integrate "View Differences" integrate_review
AddDropDownMenuSeparator integrate
AddDropDownMenuCommand integrate "Build" integrate_build
AddDropDownMenuSeparator integrate
AddDropDownMenuCommand integrate "New Tests" integrate_new_tests
AddDropDownMenuCommand integrate "Baseline Test" \
integrate_baseline_test
AddDropDownMenuCommand integrate "Regression Test" \
integrate_regression_tests
AddDropDownMenuSeparator integrate
AddDropDownMenuCommand integrate "Pass" integrate_pass
AddDropDownMenuCommand integrate "Fail" integrate_fail
}
}
proc integrate_begin {} {
global branch change
if [select_change "ib" "begin integration"] {
aegis_integrate_begin $branch $change
}
}
proc integrate_resume {} {
select_change "ibu" "resume integration"
}
proc integrate_begin_undo {} {
global branch change
if [select_change "ibu" "undo integration"] {
if [aegis_integrate_begin_undo $branch $change] {
show_message "Info" "Cancelled integration"
}
}
}
proc integrate_review {} {
global branch change
if [select_change "ibu" "integration review" ] {
aegis_show_diffs $branch $change
}
}
proc integrate_build {} {
if [select_change "ibu" "integration build"] {
build_project
}
}
proc integrate_new_tests {} {
if [select_change "ibu" "integration new tests"] {
run_tests
}
}
proc integrate_regression_tests {} {
if [select_change "ibu" "integration regression tests"] {
run_regression_tests
}
}
proc integrate_baseline_test {} {
if [select_change "ibu" "integration baseline test"] {
run_baseline_test
}
}
proc integrate_pass {} {
global branch change
if [select_change "ibu" "pass integration"] {
aegis_trash_diffs
cd ..
aegis_integrate_pass $branch $change
}
}
proc integrate_fail {} {
global branch change
if [select_change "ibu" "fail integration"] {
aegis_trash_diffs
aegis_integrate_fail $branch $change
}
}
proc leave_integrate_mode {} {
aegis_trash_diffs
DestroyMainMenuItem integrate
}
################################################################
# Switch in/out of modes
proc leave_mode {} {
global mode
if {$mode == "administrate"} {
leave_administrate_mode
} elseif {$mode == "develop"} {
leave_develop_mode
} elseif {$mode == "review"} {
leave_review_mode
} elseif {$mode == "integrate"} {
leave_integrate_mode
}
set mode "none"
}
proc enter_mode {mode} {
if {$mode == "administrate"} {
enter_administrate_mode
} elseif {$mode == "develop"} {
enter_develop_mode
} elseif {$mode == "integrate"} {
enter_integrate_mode
} elseif {$mode == "review"} {
enter_review_mode
}
}
add_project_menu
focus .mbar
|