Skip to content

Commit 6c3d4de

Browse files
committed
Change status symbol and improve error message
(1) Change 'm' to 's' to denote out-of-sync: I found it hard to remember what was meant by 'm' vs. 'M'. Hopefully it will be easier to remember 's' vs. 'M'. (2) Improve the message when checkout_externals fails to run because one or more externals are in a modified 'M' state. User interface changes?: Yes Changed 'm' to 's' Testing: python2 make test - all tests pass, on skip system test
2 parents 013b82c + 9fee6a0 commit 6c3d4de

File tree

3 files changed

+33
-22
lines changed

3 files changed

+33
-22
lines changed

README.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ The root of the source tree will be referred to as `${SRC_ROOT}` below.
8383
$ ./manage_externals/checkout_externals --status
8484

8585
./cime
86-
m ./components/cism
86+
s ./components/cism
8787
./components/mosart
8888
e-o ./components/rtm
8989
M ./src/fates
@@ -95,17 +95,18 @@ The root of the source tree will be referred to as `${SRC_ROOT}` below.
9595
* column two indicates whether the working copy has modified files.
9696
* column three shows how the repository is managed, optional or required
9797

98-
Colunm one will be one of these values:
99-
* m : modified : repository is modified compared to the externals description
98+
Column one will be one of these values:
99+
* s : out-of-sync : repository is checked out at a different commit
100+
compared with the externals description
100101
* e : empty : directory does not exist - checkout_externals has not been run
101102
* ? : unknown : directory exists but .git or .svn directories are missing
102103

103-
Colunm two will be one of these values:
104-
* M : Modified : untracked, modified, added, deleted or missing files
104+
Column two will be one of these values:
105+
* M : Modified : modified, added, deleted or missing files
105106
* : blank / space : clean
106107
* - : dash : no meaningful state, for empty repositories
107108

108-
Colunm three will be one of these values:
109+
Column three will be one of these values:
109110
* o : optional : optionally repository
110111
* : blank / space : required repository
111112

manic/checkout.py

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
import os
1616
import os.path
1717
import sys
18-
import textwrap
1918

2019
from manic.externals_description import create_externals_description
2120
from manic.externals_description import read_externals_description_file
@@ -108,7 +107,7 @@ def commandline_arguments(args=None):
108107
$ ./manage_externals/%(prog)s --status
109108
110109
./cime
111-
m ./components/cism
110+
s ./components/cism
112111
./components/mosart
113112
e-o ./components/rtm
114113
M ./src/fates
@@ -121,17 +120,18 @@ def commandline_arguments(args=None):
121120
* column two indicates whether the working copy has modified files.
122121
* column three shows how the repository is managed, optional or required
123122
124-
Colunm one will be one of these values:
125-
* m : modified : repository is modified compared to the externals description
123+
Column one will be one of these values:
124+
* s : out-of-sync : repository is checked out at a different commit
125+
compared with the externals description
126126
* e : empty : directory does not exist - %(prog)s has not been run
127127
* ? : unknown : directory exists but .git or .svn directories are missing
128128
129-
Colunm two will be one of these values:
130-
* M : Modified : untracked, modified, added, deleted or missing files
129+
Column two will be one of these values:
130+
* M : Modified : modified, added, deleted or missing files
131131
* : blank / space : clean
132132
* - : dash : no meaningful state, for empty repositories
133133
134-
Colunm three will be one of these values:
134+
Column three will be one of these values:
135135
* o : optional : optionally repository
136136
* : blank / space : required repository
137137
@@ -260,7 +260,8 @@ def main(args):
260260
datefmt='%Y-%m-%d %H:%M:%S',
261261
level=logging.DEBUG)
262262

263-
logging.info('Begining of checkout_externals')
263+
program_name = os.path.basename(sys.argv[0])
264+
logging.info('Beginning of %s', program_name)
264265

265266
load_all = False
266267
if args.optional:
@@ -287,19 +288,28 @@ def main(args):
287288
for comp in sorted(tree_status.keys()):
288289
tree_status[comp].log_status_message(args.verbose)
289290
# exit gracefully
290-
msg = textwrap.fill(
291-
'Some external repositories are not in a clean state. '
292-
'(Generally, these are repositories with "M" in the '
293-
'second column in the above status output.) '
294-
'Please ensure all external repositories are clean '
295-
'before updating.')
291+
msg = """The external repositories labeled with 'M' above are not in a clean state.
292+
293+
The following are two options for how to proceed:
294+
295+
(1) Go into each external that is not in a clean state and issue either
296+
an 'svn status' or a 'git status' command. Either revert or commit
297+
your changes so that all externals are in a clean state. (Note,
298+
though, that it is okay to have untracked files in your working
299+
directory.) Then rerun {program_name}.
300+
301+
(2) Alternatively, you do not have to rely on {program_name}. Instead, you
302+
can manually update out-of-sync externals (labeled with 's' above)
303+
as described in the configuration file {config_file}.
304+
""".format(program_name=program_name, config_file=args.externals)
305+
296306
printlog('-' * 70)
297307
printlog(msg)
298308
printlog('-' * 70)
299309
else:
300310
source_tree.checkout(args.verbose, load_all)
301311
printlog('')
302312

303-
logging.info('checkout_externals completed without exceptions.')
313+
logging.info('%s completed without exceptions.', program_name)
304314
# NOTE(bja, 2017-11) tree status is used by the systems tests
305315
return 0, tree_status

manic/externals_status.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class ExternalStatus(object):
3232
DEFAULT = '-'
3333
UNKNOWN = '?'
3434
EMPTY = 'e'
35-
MODEL_MODIFIED = 'm'
35+
MODEL_MODIFIED = 's' # a.k.a. out-of-sync
3636
DIRTY = 'M'
3737

3838
STATUS_OK = ' '

0 commit comments

Comments
 (0)