[git-review] Catch internal exceptions

Pete Zaitcev zaitcev at fedoraproject.org
Fri Feb 6 03:28:33 UTC 2015


commit 95459d9544a7ede3a817407113aaadd07c42e788
Author: Pete Zaitcev <zaitcev at kotori.zaitcev.us>
Date:   Thu Feb 5 20:26:22 2015 -0700

    Catch internal exceptions
    
    This avoids tripping abrtd on every operational error like pushing
    wrong branch or such.
    
    Resolves: bz#1188913

 git-review-1.24-main.patch |   48 ++++++++++++++++++++++++++++++++++++++++++++
 git-review.spec            |    7 +++++-
 2 files changed, 54 insertions(+), 1 deletions(-)
---
diff --git a/git-review-1.24-main.patch b/git-review-1.24-main.patch
new file mode 100644
index 0000000..e64ddfb
--- /dev/null
+++ b/git-review-1.24-main.patch
@@ -0,0 +1,48 @@
+(cherry-picked with corrections)
+
+commit 856ccd958bd4c47158aae574b6211f7da2b57be7
+Author: Cedric Brandily <zzelle at gmail.com>
+Date:   Thu Sep 4 14:24:59 2014 +0200
+
+    Align git-review and python -m git_review.cmd behaviors
+    
+    Currently, python -m git_review.cmd wraps git_review.cmd.main call to
+    handle correctly unicode in python2 where git-review calls directly
+    git_review.cmd.main. This change embeds the wrapper inside main in
+    order to align git-review and python -m git_review.cmd behaviors.
+    
+    Change-Id: I390e2d68b851299c3b07292b89dee8198068e6aa
+
+diff --git a/git_review/cmd.py b/git_review/cmd.py
+index a1c655a..2619989 100755
+--- a/git_review/cmd.py
++++ b/git_review/cmd.py
+@@ -1033,7 +1043,7 @@ def convert_bool(one_or_zero):
+     return one_or_zero in ["1", "true", "True"]
+ 
+ 
+-def main():
++def _main():
+     usage = "git review [OPTIONS] ... [BRANCH]"
+ 
+     import argparse
+@@ -1256,9 +1262,9 @@ def main():
+     sys.exit(status)
+ 
+ 
+-if __name__ == "__main__":
++def main():
+     try:
+-        main()
++        _main()
+     except GitReviewException as e:
+         # If one does unguarded print(e) here, in certain locales the implicit
+         # str(e) blows up with familiar "UnicodeEncodeError ... ordinal not in
+@@ -1269,3 +1277,7 @@ if __name__ == "__main__":
+         else:
+             print(u.encode('utf-8'))
+         sys.exit(e.EXIT_CODE)
++
++
++if __name__ == "__main__":
++    main()
diff --git a/git-review.spec b/git-review.spec
index 519bfab..12fc2d4 100644
--- a/git-review.spec
+++ b/git-review.spec
@@ -1,6 +1,6 @@
 Name:		git-review
 Version:	1.24
-Release:	3%{?dist}
+Release:	4%{?dist}
 Summary:	A Git helper for integration with Gerrit
 
 Group:		Development/Tools
@@ -9,6 +9,7 @@ URL:		https://github.com/openstack-infra/git-review
 Source0:	http://tarballs.openstack.org/git-review/git-review-%{version}.tar.gz
 Source1:	git-review.conf
 Patch1:		git-review-1.24-man.patch
+Patch2:		git-review-1.24-main.patch
 
 BuildArch:	noarch
 BuildRequires:	python2-devel
@@ -26,6 +27,7 @@ requests in the patch management system Gerrit. It replaces the rfc.sh script.
 %setup -q
 
 %patch1 -p1
+%patch2 -p1
 
 %build
 %{__python} setup.py build
@@ -61,6 +63,9 @@ rm -rf %{buildroot}
 %doc README.rst
 
 %changelog
+* Thu Feb 05 2015 Pete Zaitcev <zaitcev at redhat.com> - 1.24-4
+- Catch internal exceptions properly, avoid tripping abrtd (#1188913)
+
 * Thu Dec 11 2014 Pete Zaitcev <zaitcev at redhat.com> - 1.24-3
 - Fix up the man page (#1170410)
 


More information about the scm-commits mailing list