D3829: rebase: make dry-run return 1 or 0 according to result
This revision was automatically updated to reflect the committed changes. Closed by commit rHGe6b643ccf87d: rebase: make dry-run return 1 or 0 according to result (authored by khanchi97, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3829?vs=9270=9271 REVISION DETAIL https://phab.mercurial-scm.org/D3829 AFFECTED FILES hgext/rebase.py tests/test-rebase-inmemory.t CHANGE DETAILS diff --git a/tests/test-rebase-inmemory.t b/tests/test-rebase-inmemory.t --- a/tests/test-rebase-inmemory.t +++ b/tests/test-rebase-inmemory.t @@ -287,6 +287,7 @@ rollback completed hit a merge conflict rebase aborted + [1] $ hg diff $ hg status $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n" @@ -322,3 +323,4 @@ merging e hit a merge conflict rebase aborted + [1] diff --git a/hgext/rebase.py b/hgext/rebase.py --- a/hgext/rebase.py +++ b/hgext/rebase.py @@ -825,8 +825,10 @@ **opts) except error.InMemoryMergeConflictsError: ui.status(_('hit a merge conflict\n')) +return 1 else: ui.status(_('there will be no conflict, you can rebase\n')) +return 0 finally: _origrebase(ui, repo, abort=True) elif inmemory: To: khanchi97, #hg-reviewers, pulkit Cc: yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3829: rebase: make dry-run return 1 or 0 according to result
khanchi97 updated this revision to Diff 9270. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3829?vs=9261=9270 REVISION DETAIL https://phab.mercurial-scm.org/D3829 AFFECTED FILES hgext/rebase.py tests/test-rebase-inmemory.t CHANGE DETAILS diff --git a/tests/test-rebase-inmemory.t b/tests/test-rebase-inmemory.t --- a/tests/test-rebase-inmemory.t +++ b/tests/test-rebase-inmemory.t @@ -287,6 +287,7 @@ rollback completed hit a merge conflict rebase aborted + [1] $ hg diff $ hg status $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n" @@ -322,3 +323,4 @@ merging e hit a merge conflict rebase aborted + [1] diff --git a/hgext/rebase.py b/hgext/rebase.py --- a/hgext/rebase.py +++ b/hgext/rebase.py @@ -825,8 +825,10 @@ **opts) except error.InMemoryMergeConflictsError: ui.status(_('hit a merge conflict\n')) +return 1 else: ui.status(_('there will be no conflict, you can rebase\n')) +return 0 finally: _origrebase(ui, repo, abort=True) elif inmemory: To: khanchi97, #hg-reviewers Cc: yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: D3829: rebase: make dry-run return 1 or 0 according to result
> --- a/hgext/rebase.py > +++ b/hgext/rebase.py > @@ -825,10 +825,13 @@ > **opts) > except error.InMemoryMergeConflictsError: > ui.status(_('hit a merge conflict\n')) > +retcode = 1 > else: > +retcode = 0 > ui.status(_('there will be no conflict, you can rebase\n')) > finally: > _origrebase(ui, repo, abort=True) > +return retcode `retcode` may be undefined depending on the error type occurred in `_origrebase()`. Instead, you can simply return 1 and 0 in the `except` and `else` clauses respectively. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3829: rebase: make dry-run return 1 or 0 according to result
yuja added a comment. > - a/hgext/rebase.py +++ b/hgext/rebase.py @@ -825,10 +825,13 @@ **opts) except error.InMemoryMergeConflictsError: ui.status(_('hit a merge conflict\n')) +retcode = 1 else: +retcode = 0 ui.status(_('there will be no conflict, you can rebase\n')) finally: _origrebase(ui, repo, abort=True) +return retcode `retcode` may be undefined depending on the error type occurred in `_origrebase()`. Instead, you can simply return 1 and 0 in the `except` and `else` clauses respectively. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3829 To: khanchi97, #hg-reviewers Cc: yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3829: rebase: make dry-run return 1 or 0 according to result
khanchi97 created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY In dry-run mode, if there is no conflict return 0, if any then return 1 REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3829 AFFECTED FILES hgext/rebase.py tests/test-rebase-inmemory.t CHANGE DETAILS diff --git a/tests/test-rebase-inmemory.t b/tests/test-rebase-inmemory.t --- a/tests/test-rebase-inmemory.t +++ b/tests/test-rebase-inmemory.t @@ -287,6 +287,7 @@ rollback completed hit a merge conflict rebase aborted + [1] $ hg diff $ hg status $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n" @@ -322,3 +323,4 @@ merging e hit a merge conflict rebase aborted + [1] diff --git a/hgext/rebase.py b/hgext/rebase.py --- a/hgext/rebase.py +++ b/hgext/rebase.py @@ -825,10 +825,13 @@ **opts) except error.InMemoryMergeConflictsError: ui.status(_('hit a merge conflict\n')) +retcode = 1 else: +retcode = 0 ui.status(_('there will be no conflict, you can rebase\n')) finally: _origrebase(ui, repo, abort=True) +return retcode elif inmemory: try: # in-memory merge doesn't support conflicts, so if we hit any, abort To: khanchi97, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel