Changeset 5094 for LMDZ6/branches/Amaury_dev/tools/fcm/bin/fcm_gui
- Timestamp:
- Jul 21, 2024, 1:47:00 PM (17 months ago)
- File:
-
- 1 edited
-
LMDZ6/branches/Amaury_dev/tools/fcm/bin/fcm_gui (modified) (16 diffs)
Legend:
- Unmodified
- Added
- Removed
-
LMDZ6/branches/Amaury_dev/tools/fcm/bin/fcm_gui
r1578 r5094 1 #!/usr/bin/perl 2 # ------------------------------------------------------------------------------ 3 # NAME 4 # fcm_gui 1 #!/usr/bin/env perl 2 #------------------------------------------------------------------------------- 3 # Copyright (C) 2006-2021 British Crown (Met Office) & Contributors. 5 4 # 6 # SYNOPSIS 7 # fcm_gui [DIR] 5 # This file is part of FCM, tools for managing and building source code. 8 6 # 9 # DESCRIPTION10 # The fcm_gui command is a simple graphical user interface for some of the11 # commands of the FCM system. The optional argument DIR modifies the initial12 # working directory.7 # FCM is free software: you can redistribute it and/or modify 8 # it under the terms of the GNU General Public License as published by 9 # the Free Software Foundation, either version 3 of the License, or 10 # (at your option) any later version. 13 11 # 14 # COPYRIGHT 15 # (C) Crown copyright Met Office. All rights reserved. 16 # For further details please refer to the file COPYRIGHT.txt 17 # which you should have received as part of this distribution. 18 # ------------------------------------------------------------------------------ 19 20 # Standard pragmas 12 # FCM is distributed in the hope that it will be useful, 13 # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 # GNU General Public License for more details. 16 # 17 # You should have received a copy of the GNU General Public License 18 # along with FCM. If not, see <http://www.gnu.org/licenses/>. 19 #------------------------------------------------------------------------------- 20 21 use strict; 21 22 use warnings; 22 use strict; 23 24 # Standard modules 25 use File::Basename; 26 use File::Spec::Functions; 27 use Cwd; 23 24 use FindBin; 25 use lib "$FindBin::Bin/../lib"; 26 use Cwd qw{cwd}; 27 use FCM::Context::Event; 28 use FCM::Util; 29 use FCM1::Config; 30 use FCM1::Keyword; 31 use FCM1::Timer qw{timestamp_command}; 32 use FCM1::Util qw{get_url_of_wc get_wct is_wc}; 33 use File::Basename qw{basename}; 34 use File::Spec::Functions qw{catfile rel2abs}; 28 35 use Tk; 29 36 use Tk::ROText; 30 31 # FCM component modules:32 use lib catfile (dirname (dirname ($0)), 'lib');33 use Fcm::Config;34 use Fcm::Util;35 use Fcm::Timer;36 37 37 38 # ------------------------------------------------------------------------------ … … 43 44 } 44 45 46 FCM1::Keyword::set_util(FCM::Util->new()); 47 45 48 # Get configuration settings 46 my $config = F cm::Config->new ();49 my $config = FCM1::Config->new (); 47 50 $config->get_config (); 48 51 … … 91 94 DELETE => 'remove files and directories from version control.', 92 95 MERGE => 'merge changes into your working copy.', 93 CONFLICTS => 'use "xxdiff" to resolve any conflicts within your working copy.',96 CONFLICTS => 'use a graphical tool to resolve conflicts in your working copy.', 94 97 COMMIT => 'send changes from your working copy to the repository.', 95 98 UPDATE => 'bring changes from the repository into your working copy.', … … 130 133 TYPE => 'DEV', 131 134 REVFLAG => 'NORMAL', 132 REV => '',133 135 TICKET => '', 134 136 SRCTYPE => 'trunk', … … 156 158 DIFF => { 157 159 USEWCT => 0, 158 GRAPHIC => 1,160 TOOL => 'graphical', 159 161 BRANCH => 0, 160 162 URL => '', … … 265 267 S_OTH => 'Show other', 266 268 VERBOSE => 'Print extra information', 269 ); 270 271 # List of diff display options 272 my %diff_display_opt = ( 273 default => 'Default mode', 274 graphical => 'Graphical tool', 275 trac => 'Trac (only for diff relative to the base of the branch)', 267 276 ); 268 277 … … 485 494 $subcmd_f{$name}->Entry ( 486 495 '-textvariable' => \($subcmdvar{$name}{NAME}), 487 )->grid (488 '-row' => $row{$name}++,489 '-column' => 1,490 '-sticky' => 'ew',491 );492 493 # Label and entry box for specifying create branch source revision494 $subcmd_f{$name}->Label (495 '-text' => 'Source revision (create/list only): ',496 )->grid (497 '-row' => $row{$name},498 '-column' => 0,499 '-sticky' => 'w',500 );501 $subcmd_f{$name}->Entry (502 '-textvariable' => \($subcmdvar{$name}{REV}),503 496 )->grid ( 504 497 '-row' => $row{$name}++, … … 720 713 my $name = 'DIFF'; 721 714 722 # Checkbuttons for various options723 $subcmd_f{$name}->Checkbutton (724 '-text' => 'Use xxdiff to display differences',725 '-variable' => \($subcmdvar{$name}{GRAPHIC}),726 )->grid (727 '-row' => $row{$name}++,728 '-column' => 0,729 '-columnspan' => 2,730 '-sticky' => 'w',731 );732 733 715 my $entry; 734 716 $subcmd_f{$name}->Checkbutton ( … … 746 728 '-sticky' => 'w', 747 729 ); 730 731 # Label and radio buttons box for specifying tool 732 $subcmd_f{$name}->Label ( 733 '-text' => 'Display diff in: ', 734 )->grid ( 735 '-row' => $row{$name}, 736 '-column' => 0, 737 '-sticky' => 'w', 738 ); 739 740 { 741 my $opt_f = $subcmd_f{$name}->Frame ()->grid ( 742 '-row' => $row{$name}++, 743 '-column' => 1, 744 '-sticky' => 'w', 745 ); 746 747 my $col = 0; 748 for my $key (qw/default graphical trac/) { 749 my $txt = $diff_display_opt{$key}; 750 my $opt = $key; 751 752 $branch_opt{$key} = $opt_f->Radiobutton ( 753 '-text' => $txt, 754 '-value' => $opt, 755 '-variable' => \($subcmdvar{$name}{TOOL}), 756 '-state' => 'normal', 757 )->grid ( 758 '-row' => 0, 759 '-column' => $col++, 760 '-sticky' => 'w', 761 ); 762 } 763 } 748 764 749 765 $subcmd_f{$name}->Label ('-text' => 'Branch URL')->grid ( … … 980 996 # ------------------------------------------------------------------------------ 981 997 # SYNOPSIS 982 # $cfg = &main::cfg ();983 #984 # DESCRIPTION985 # Return the $config variable.986 # ------------------------------------------------------------------------------987 988 sub cfg {989 return $config;990 }991 992 # ------------------------------------------------------------------------------993 # SYNOPSIS994 998 # &change_cwd ($dir); 995 999 # … … 1113 1117 # 1114 1118 # DESCRIPTION 1115 # Setup the thesystem command for the sub-command $name.1119 # Setup the system command for the sub-command $name. 1116 1120 # ------------------------------------------------------------------------------ 1117 1121 … … 1121 1125 1122 1126 if ($name eq 'BRANCH') { 1123 $cmd .= lc ($name);1124 1127 if ($subcmdvar{$name}{OPT} eq 'create') { 1125 $cmd .= ' -c --svn-non-interactive';1126 $cmd .= ' - n ' . $subcmdvar{$name}{NAME} if $subcmdvar{$name}{NAME};1128 $cmd .= 'branch-create'; 1129 $cmd .= ' --svn-non-interactive'; 1127 1130 $cmd .= ' -t ' . $subcmdvar{$name}{TYPE}; 1128 1131 $cmd .= ' --rev-flag ' . $subcmdvar{$name}{REVFLAG}; 1129 $cmd .= ' -r ' . $subcmdvar{$name}{REV} if $subcmdvar{$name}{REV};1130 1132 $cmd .= ' -k ' . $subcmdvar{$name}{TICKET} if $subcmdvar{$name}{TICKET}; 1131 1133 $cmd .= ' --branch-of-branch ' if $subcmdvar{$name}{SRCTYPE} eq 'branch'; 1134 $cmd .= ' ' . $subcmdvar{$name}{NAME}; 1132 1135 1133 1136 } elsif ($subcmdvar{$name}{OPT} eq 'delete') { 1137 $cmd .= 'branch-delete'; 1134 1138 $cmd .= ' -v' if $subcmdvar{$name}{VERBOSE}; 1135 $cmd .= ' - d --svn-non-interactive';1139 $cmd .= ' --svn-non-interactive'; 1136 1140 1137 1141 } elsif ($subcmdvar{$name}{OPT} eq 'list') { 1138 $cmd .= ' -l'; 1139 $cmd .= ' -r ' . $subcmdvar{$name}{REV} if $subcmdvar{$name}{REV}; 1142 $cmd .= 'branch-list'; 1140 1143 1141 1144 } else { 1142 $cmd .= ' -i';1145 $cmd .= 'branch-info'; 1143 1146 $cmd .= ' --show-children' if $subcmdvar{$name}{S_CHD}; 1144 1147 $cmd .= ' --show-siblings' if $subcmdvar{$name}{S_SIB}; … … 1163 1166 1164 1167 } elsif ($name eq 'DIFF') { 1165 $cmd .= lc ($name);1166 $cmd .= ' -g' if $subcmdvar{$name}{GRAPHIC};1167 1168 1168 if ($subcmdvar{$name}{BRANCH}) { 1169 $cmd .= ' -b'; 1169 $cmd .= 'branch-diff'; 1170 $cmd .= ' -t' if $subcmdvar{$name}{TOOL} eq 'trac'; 1170 1171 $cmd .= ' ' . $subcmdvar{$name}{URL} if $subcmdvar{$name}{URL}; 1171 1172 } 1172 1173 else { 1174 $cmd .= 'diff'; 1175 } 1176 1177 $cmd .= ' -g' if $subcmdvar{$name}{TOOL} eq 'graphical'; 1173 1178 $cmd .= ' ' . $subcmdvar{$name}{OTHER} if $subcmdvar{$name}{OTHER}; 1174 1179 … … 1232 1237 $cmd = (index ($cmd, 'help ') == 0) 1233 1238 ? $disp_cmd 1234 : ('fcm _gui_internal ' . &get_wm_pos () . ' ' . $cmd);1239 : ('fcm gui-internal ' . &get_wm_pos () . ' ' . $cmd); 1235 1240 1236 1241 # Change directory to working copy top if necessary … … 1289 1294 1290 1295 # If the command is "checkout", change directory to working copy 1291 if (lc ($selsubcmd) eq 'checkout' ) {1292 my $url = expand_url_keyword (URL =>$subcmdvar{CHECKOUT}{URL});1296 if (lc ($selsubcmd) eq 'checkout' && $subcmdvar{CHECKOUT}{URL}) { 1297 my $url = FCM1::Keyword::expand($subcmdvar{CHECKOUT}{URL}); 1293 1298 my $dir = $subcmdvar{CHECKOUT}{PATH} 1294 1299 ? $subcmdvar{CHECKOUT}{PATH} 1295 : basename $url;1296 $dir = File::Spec->rel2abs($dir);1300 : basename($url); 1301 $dir = rel2abs($dir); 1297 1302 &change_cwd ($dir); 1298 1303 … … 1320 1325 1321 1326 __END__ 1327 1328 =head1 NAME 1329 1330 fcm_gui 1331 1332 =head1 SYNOPSIS 1333 1334 fcm_gui [DIR] 1335 1336 =head1 DESCRIPTION 1337 1338 The fcm_gui command is a simple graphical user interface for some of the 1339 commands of the FCM system. The optional argument DIR modifies the initial 1340 working directory. 1341 1342 =head1 COPYRIGHT 1343 1344 Copyright (C) 2006-2021 British Crown (Met Office) & Contributors. 1345 1346 =cut
Note: See TracChangeset
for help on using the changeset viewer.
