Patchwork [5,of,5] dispatch: exit with status 1 for an InterventionRequired exception (bc)

login
register
mail settings
Submitter Augie Fackler
Date Feb. 8, 2013, 10:49 p.m.
Message ID <f7f9b0475f5b74df861b.1360363794@augie-macbookair>
Download mbox | patch
Permalink /patch/850/
State Accepted
Commit e5d9441ec281fb0888772d907fbf8e89915555d9
Headers show

Comments

Augie Fackler - Feb. 8, 2013, 10:49 p.m.
# HG changeset patch
# User Augie Fackler <raf@durin42.com>
# Date 1360361866 21600
# Node ID f7f9b0475f5b74df861bdef1684bef8c976e4196
# Parent  c74fa66f8dd73ce2bb11b359cbfc71d570af7533
dispatch: exit with status 1 for an InterventionRequired exception (bc)
Mads Kiilerich - Feb. 9, 2013, 11:45 a.m.
On 02/08/2013 11:49 PM, Augie Fackler wrote:
> # HG changeset patch
> # User Augie Fackler <raf@durin42.com>
> # Date 1360361866 21600
> # Node ID f7f9b0475f5b74df861bdef1684bef8c976e4196
> # Parent  c74fa66f8dd73ce2bb11b359cbfc71d570af7533
> dispatch: exit with status 1 for an InterventionRequired exception (bc)

Exactly what will this change? From the tests it seems like it only will 
change from one 'not success' exit code to another?

And why this change? To be able to distinguish aborts from less fatal cases?

Shouldn't this be documented somewhere if it is a new reliable convention?

/Mads

> diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py
> --- a/mercurial/dispatch.py
> +++ b/mercurial/dispatch.py
> @@ -153,6 +153,7 @@
>               commands.help_(ui, 'shortlist')
>       except error.InterventionRequired, inst:
>           ui.warn("%s\n" % inst)
> +        return 1
>       except util.Abort, inst:
>           ui.warn(_("abort: %s\n") % inst)
>           if inst.hint:
> diff --git a/tests/test-histedit-fold.t b/tests/test-histedit-fold.t
> --- a/tests/test-histedit-fold.t
> +++ b/tests/test-histedit-fold.t
> @@ -183,7 +183,7 @@
>     warning: conflicts during merge.
>     merging file incomplete! (edit conflicts, then use 'hg resolve --mark')
>     Fix up the change and run hg histedit --continue
> -  [255]
> +  [1]
>   There were conflicts, we keep P1 content. This
>   should effectively drop the changes from +6.
>     $ hg status
> @@ -248,7 +248,7 @@
>     warning: conflicts during merge.
>     merging file incomplete! (edit conflicts, then use 'hg resolve --mark')
>     Fix up the change and run hg histedit --continue
> -  [255]
> +  [1]
>     $ cat > file << EOF
>     > 1
>     > 2
>
Augie Fackler - Feb. 9, 2013, 11:49 a.m.
On Feb 9, 2013, at 11:45 AM, Mads Kiilerich <mads@kiilerich.com> wrote:

> On 02/08/2013 11:49 PM, Augie Fackler wrote:
>> # HG changeset patch
>> # User Augie Fackler <raf@durin42.com>
>> # Date 1360361866 21600
>> # Node ID f7f9b0475f5b74df861bdef1684bef8c976e4196
>> # Parent  c74fa66f8dd73ce2bb11b359cbfc71d570af7533
>> dispatch: exit with status 1 for an InterventionRequired exception (bc)
> 
> Exactly what will this change? From the tests it seems like it only will change from one 'not success' exit code to another?
> 
> And why this change? To be able to distinguish aborts from less fatal cases?
> 
> Shouldn't this be documented somewhere if it is a new reliable convention?

Matt said he didn't like it being status 255, which we generally only use for things that are fatal. Merge returns status 1 when it requires intervention, so I was following that convention.

> 
> /Mads
> 
>> diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py
>> --- a/mercurial/dispatch.py
>> +++ b/mercurial/dispatch.py
>> @@ -153,6 +153,7 @@
>>              commands.help_(ui, 'shortlist')
>>      except error.InterventionRequired, inst:
>>          ui.warn("%s\n" % inst)
>> +        return 1
>>      except util.Abort, inst:
>>          ui.warn(_("abort: %s\n") % inst)
>>          if inst.hint:
>> diff --git a/tests/test-histedit-fold.t b/tests/test-histedit-fold.t
>> --- a/tests/test-histedit-fold.t
>> +++ b/tests/test-histedit-fold.t
>> @@ -183,7 +183,7 @@
>>    warning: conflicts during merge.
>>    merging file incomplete! (edit conflicts, then use 'hg resolve --mark')
>>    Fix up the change and run hg histedit --continue
>> -  [255]
>> +  [1]
>>  There were conflicts, we keep P1 content. This
>>  should effectively drop the changes from +6.
>>    $ hg status
>> @@ -248,7 +248,7 @@
>>    warning: conflicts during merge.
>>    merging file incomplete! (edit conflicts, then use 'hg resolve --mark')
>>    Fix up the change and run hg histedit --continue
>> -  [255]
>> +  [1]
>>    $ cat > file << EOF
>>    > 1
>>    > 2
>> 
>

Patch

diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py
--- a/mercurial/dispatch.py
+++ b/mercurial/dispatch.py
@@ -153,6 +153,7 @@ 
             commands.help_(ui, 'shortlist')
     except error.InterventionRequired, inst:
         ui.warn("%s\n" % inst)
+        return 1
     except util.Abort, inst:
         ui.warn(_("abort: %s\n") % inst)
         if inst.hint:
diff --git a/tests/test-histedit-fold.t b/tests/test-histedit-fold.t
--- a/tests/test-histedit-fold.t
+++ b/tests/test-histedit-fold.t
@@ -183,7 +183,7 @@ 
   warning: conflicts during merge.
   merging file incomplete! (edit conflicts, then use 'hg resolve --mark')
   Fix up the change and run hg histedit --continue
-  [255]
+  [1]
 There were conflicts, we keep P1 content. This
 should effectively drop the changes from +6.
   $ hg status
@@ -248,7 +248,7 @@ 
   warning: conflicts during merge.
   merging file incomplete! (edit conflicts, then use 'hg resolve --mark')
   Fix up the change and run hg histedit --continue
-  [255]
+  [1]
   $ cat > file << EOF
   > 1
   > 2
diff --git a/tests/test-histedit-obsolete.t b/tests/test-histedit-obsolete.t
--- a/tests/test-histedit-obsolete.t
+++ b/tests/test-histedit-obsolete.t
@@ -141,7 +141,7 @@ 
   adding c
   Make changes as needed, you may commit or record as needed now.
   When you are finished, run hg histedit --continue to resume.
-  [255]
+  [1]
   $ echo c >> c
   $ hg histedit --continue
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
@@ -280,7 +280,7 @@ 
   adding f
   Make changes as needed, you may commit or record as needed now.
   When you are finished, run hg histedit --continue to resume.
-  [255]
+  [1]
   $ echo f >> f
   $ hg histedit --continue
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
@@ -330,7 +330,7 @@ 
   adding f
   Make changes as needed, you may commit or record as needed now.
   When you are finished, run hg histedit --continue to resume.
-  [255]
+  [1]
   $ echo f >> f
   $ hg histedit --continue
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
diff --git a/tests/test-rebase-abort.t b/tests/test-rebase-abort.t
--- a/tests/test-rebase-abort.t
+++ b/tests/test-rebase-abort.t
@@ -56,7 +56,7 @@ 
   warning: conflicts during merge.
   merging common incomplete! (edit conflicts, then use 'hg resolve --mark')
   unresolved conflicts (see hg resolve, then hg rebase --continue)
-  [255]
+  [1]
 
 Abort:
 
@@ -127,7 +127,7 @@ 
   warning: conflicts during merge.
   merging c incomplete! (edit conflicts, then use 'hg resolve --mark')
   unresolved conflicts (see hg resolve, then hg rebase --continue)
-  [255]
+  [1]
 
   $ hg tglog
   @  4:draft 'C1'
diff --git a/tests/test-rebase-bookmarks.t b/tests/test-rebase-bookmarks.t
--- a/tests/test-rebase-bookmarks.t
+++ b/tests/test-rebase-bookmarks.t
@@ -142,7 +142,7 @@ 
   warning: conflicts during merge.
   merging c incomplete! (edit conflicts, then use 'hg resolve --mark')
   unresolved conflicts (see hg resolve, then hg rebase --continue)
-  [255]
+  [1]
   $ echo 'c' > c
   $ hg resolve --mark c
   $ hg rebase --continue
diff --git a/tests/test-rebase-check-restore.t b/tests/test-rebase-check-restore.t
--- a/tests/test-rebase-check-restore.t
+++ b/tests/test-rebase-check-restore.t
@@ -70,7 +70,7 @@ 
   warning: conflicts during merge.
   merging A incomplete! (edit conflicts, then use 'hg resolve --mark')
   unresolved conflicts (see hg resolve, then hg rebase --continue)
-  [255]
+  [1]
 
 Solve the conflict and go on:
 
@@ -123,7 +123,7 @@ 
   warning: conflicts during merge.
   merging A incomplete! (edit conflicts, then use 'hg resolve --mark')
   unresolved conflicts (see hg resolve, then hg rebase --continue)
-  [255]
+  [1]
 
 Solve the conflict and go on:
 
diff --git a/tests/test-rebase-conflicts.t b/tests/test-rebase-conflicts.t
--- a/tests/test-rebase-conflicts.t
+++ b/tests/test-rebase-conflicts.t
@@ -65,7 +65,7 @@ 
   warning: conflicts during merge.
   merging common incomplete! (edit conflicts, then use 'hg resolve --mark')
   unresolved conflicts (see hg resolve, then hg rebase --continue)
-  [255]
+  [1]
 
 Try to continue without solving the conflict:
 
diff --git a/tests/test-rebase-detach.t b/tests/test-rebase-detach.t
--- a/tests/test-rebase-detach.t
+++ b/tests/test-rebase-detach.t
@@ -375,7 +375,7 @@ 
   warning: conflicts during merge.
   merging H incomplete! (edit conflicts, then use 'hg resolve --mark')
   unresolved conflicts (see hg resolve, then hg rebase --continue)
-  [255]
+  [1]
   $ hg resolve --all -t internal:local
   $ hg rebase -c
   saved backup bundle to $TESTTMP/a7/.hg/strip-backup/6215fafa5447-backup.hg (glob)
diff --git a/tests/test-rebase-interruptions.t b/tests/test-rebase-interruptions.t
--- a/tests/test-rebase-interruptions.t
+++ b/tests/test-rebase-interruptions.t
@@ -62,7 +62,7 @@ 
   warning: conflicts during merge.
   merging A incomplete! (edit conflicts, then use 'hg resolve --mark')
   unresolved conflicts (see hg resolve, then hg rebase --continue)
-  [255]
+  [1]
 
 Force a commit on C during the interruption:
 
@@ -98,7 +98,7 @@ 
   warning: conflicts during merge.
   merging A incomplete! (edit conflicts, then use 'hg resolve --mark')
   unresolved conflicts (see hg resolve, then hg rebase --continue)
-  [255]
+  [1]
 
 Solve the conflict and go on:
 
@@ -152,7 +152,7 @@ 
   warning: conflicts during merge.
   merging A incomplete! (edit conflicts, then use 'hg resolve --mark')
   unresolved conflicts (see hg resolve, then hg rebase --continue)
-  [255]
+  [1]
 
 Force a commit on B' during the interruption:
 
@@ -223,7 +223,7 @@ 
   warning: conflicts during merge.
   merging A incomplete! (edit conflicts, then use 'hg resolve --mark')
   unresolved conflicts (see hg resolve, then hg rebase --continue)
-  [255]
+  [1]
 
 Change phase on B and B'
 
diff --git a/tests/test-rebase-mq-skip.t b/tests/test-rebase-mq-skip.t
--- a/tests/test-rebase-mq-skip.t
+++ b/tests/test-rebase-mq-skip.t
@@ -109,7 +109,7 @@ 
 
   $ HGMERGE=internal:fail hg rebase
   unresolved conflicts (see hg resolve, then hg rebase --continue)
-  [255]
+  [1]
 
   $ HGMERGE=internal:local hg resolve --all
 
diff --git a/tests/test-rebase-mq.t b/tests/test-rebase-mq.t
--- a/tests/test-rebase-mq.t
+++ b/tests/test-rebase-mq.t
@@ -64,7 +64,7 @@ 
   warning: conflicts during merge.
   merging f incomplete! (edit conflicts, then use 'hg resolve --mark')
   unresolved conflicts (see hg resolve, then hg rebase --continue)
-  [255]
+  [1]
 
 Fix the 1st conflict:
 
@@ -75,7 +75,7 @@ 
   warning: conflicts during merge.
   merging f incomplete! (edit conflicts, then use 'hg resolve --mark')
   unresolved conflicts (see hg resolve, then hg rebase --continue)
-  [255]
+  [1]
 
 Fix the 2nd conflict:
 
diff --git a/tests/test-rebase-parameters.t b/tests/test-rebase-parameters.t
--- a/tests/test-rebase-parameters.t
+++ b/tests/test-rebase-parameters.t
@@ -417,7 +417,7 @@ 
 
   $ hg rebase -s 2 -d 1 --tool internal:fail
   unresolved conflicts (see hg resolve, then hg rebase --continue)
-  [255]
+  [1]
 
   $ hg resolve -l
   U c2