Commits

Patrick Mézard committed d639621

Change prompt, ask whether to import, default to no

  • Participants
  • Parent commits e9e705b

Comments (0)

Files changed (3)

     patch groups not matching either of them. For each query, the
     following responses are possible:
 
-    y - skip this patch group
-    i - qimport this patch group
+    n - skip this patch group
+    y - qimport this patch group
 
     d - done, import selected patches and quit
     q - quit, importing nothing
             ui.status('%s\n' % patches[0].subject)
 
         while 1:
-            choices = _('[Yidq?]')
-            r = ui.prompt(_('skip this group %s ') % choices, 
-                          '(?i)%s?$' % choices) or 'y'
+            choices = _('[Nydq?]')
+            r = ui.prompt(_('import this group? %s ') % choices, 
+                          '(?i)%s?$' % choices, default=_('n')) or _('n')
             if r == _('?'):
                 doc = gettext(mimport.__doc__)
-                c = doc.find(_('y - skip this patch group'))
+                c = doc.find(_('n - skip this patch group'))
                 for l in doc[c:].splitlines():
                     if l:
                         ui.write(l.strip(), '\n')
                 continue
-            if r == _('i'):
+            elif r == _('y'):
                 selecteds.append(patches)
             elif r == _('d'):
                 stop = True
 hg init repo
 cd repo
 
+echo % test default behaviour and help
+hg mimport <<EOF
+?
+
+EOF
+hg qseries
+
+echo % test no answer
+hg mimport <<EOF
+n
+EOF
+hg qseries
+
 echo % mimport everything
 hg mimport <<EOF
-i
+y
 EOF
+hg qseries
 

File test-mbox.out

 hg: unknown command 'mimport'
 % help (mq present)
 hg mimport PATTERN...
+% test default behaviour and help
+[PATCH] test diff
+import this group? [Nydq?]  n - skip this patch group
+y - qimport this patch group
+d - done, import selected patches and quit
+q - quit, importing nothing
+? - display help
+
+import this group? [Nydq?]  0 patches imported
+% test no answer
+[PATCH] test diff
+import this group? [Nydq?]  0 patches imported
 % mimport everything
 [PATCH] test diff
-skip this group [Yidq?]  adding test_diff to series file
+import this group? [Nydq?]  adding test_diff to series file
 1 patches imported
+test_diff