Mercurial > p > roundup > code
comparison roundup/scripts/roundup_demo.py @ 7697:c73a1177c2b2
fix: roundup-demo, interactive mode would nuke an existing tracker.
Tonu Mikk demonstrated a bug in roundup-demo. When invoked without a
tracker home on the command line, it would nuke an existing directory
specified interactively.
There is still a minor bug. If an invalid home directory is specified,
roundup-demo will prompt for the template to use before reporting:
Error: Refusing to nuke non-tracker directory:
but this doesn't cause data loss so not worth fixing at this time.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Wed, 08 Nov 2023 21:18:34 -0500 |
| parents | 7b9bddda9d2d |
| children | f5f09ed9a783 |
comparison
equal
deleted
inserted
replaced
| 7696:4af0d235b570 | 7697:c73a1177c2b2 |
|---|---|
| 136 | 136 |
| 137 home = tracker_home or DEFAULT_HOME | 137 home = tracker_home or DEFAULT_HOME |
| 138 template = cli_args.template or DEFAULT_TEMPLATE | 138 template = cli_args.template or DEFAULT_TEMPLATE |
| 139 backend = cli_args.backend_db or cli_backend or DEFAULT_BACKEND | 139 backend = cli_args.backend_db or cli_backend or DEFAULT_BACKEND |
| 140 | 140 |
| 141 if not tracker_home: | |
| 142 home = my_input( | |
| 143 _('Enter directory path to create demo tracker [%s]: ') % home) | |
| 144 if not home: | |
| 145 home = DEFAULT_HOME | |
| 146 | |
| 141 # if there is no tracker in home, force nuke | 147 # if there is no tracker in home, force nuke |
| 142 try: | 148 try: |
| 143 instance.open(home) | 149 instance.open(home) |
| 144 valid_home = True | 150 valid_home = True |
| 145 except configuration.NoConfigError: | 151 except configuration.NoConfigError: |
| 149 # if we are to create the tracker, prompt for settings | 155 # if we are to create the tracker, prompt for settings |
| 150 if nuke: | 156 if nuke: |
| 151 # FIXME: i'd like to have an option to abort the tracker creation | 157 # FIXME: i'd like to have an option to abort the tracker creation |
| 152 # say, by entering a single dot. but i cannot think of | 158 # say, by entering a single dot. but i cannot think of |
| 153 # appropriate prompt for that. | 159 # appropriate prompt for that. |
| 154 if not tracker_home: | |
| 155 home = my_input( | |
| 156 _('Enter directory path to create demo tracker [%s]: ') % home) | |
| 157 if not home: | |
| 158 home = DEFAULT_HOME | |
| 159 | |
| 160 if not cli_args.template in templates: | 160 if not cli_args.template in templates: |
| 161 template = my_input( | 161 template = my_input( |
| 162 _('Enter tracker template to use (one of (%(template_list)s)) [%(default_template)s]: ') % | 162 _('Enter tracker template to use (one of (%(template_list)s)) [%(default_template)s]: ') % |
| 163 { 'template_list': ','.join(templates), | 163 { 'template_list': ','.join(templates), |
| 164 'default_template': template}) | 164 'default_template': template}) |
