[Kimchi-devel] [PATCH] pep8 cleanup for root.py

Zhou Zheng Sheng zhshzhou at linux.vnet.ibm.com
Tue Dec 31 03:26:14 UTC 2013


于 2013年12月30日 23:06, Aline Manera 写道:
> On 12/30/2013 12:52 PM, Sheldon wrote:
>> so strangely, I can not rebase to master.
>>
>> even I resolved the conflict of the root.py, I can still not "git
>> rebase --continue"
>>
>> $ git rebase master
>> First, rewinding head to replay your work on top of it...
>> Applying: pep8 cleanup for root.py
>> Using index info to reconstruct a base tree...
>> M Makefile.am
>> M src/kimchi/root.py
>> Falling back to patching base and 3-way merge...
>> Auto-merging src/kimchi/root.py
>> CONFLICT (content): Merge conflict in src/kimchi/root.py
>> Failed to merge in the changes.
>> Patch failed at 0001 pep8 cleanup for root.py
>> The copy of the patch that failed is found in:
>> /home/shhfeng/work/workdir/kimchi/.git/rebase-apply/patch
>>
>> When you have resolved this problem, run "git rebase --continue".
>> If you prefer to skip this patch, run "git rebase --skip" instead.
>> To check out the original branch and stop rebasing, run "git rebase
>> --abort".
>>
>>
>> $ git diff
>> diff --cc src/kimchi/root.py
>> index 46403ab,d1fe818..0000000
>> --- a/src/kimchi/root.py
>> +++ b/src/kimchi/root.py
>> @@@ -58,14 -58,14 +58,22 @@@ class Root(controller.Resource)
>> self.plugins = controller.Plugins(model)
>> self.api_schema = json.load(open(get_api_schema_file()))
>>
>> ++<<<<<<< HEAD
>> + def error_production_handler(self, status, message, traceback,
>> version):
>> ++=======
>> + def error_production_handler(status, message, traceback, version):
>> ++>>>>>>> pep8 cleanup for root.py
>> data = {'code': status, 'reason': message}
>> res = template.render('error.html', data)
>> if type(res) is unicode:
>> res = res.encode("utf-8")
>> return res
>>
>> ++<<<<<<< HEAD
>> + def error_development_handler(self, status, message, traceback,
>> version):
>> ++=======
>> + def error_development_handler(status, message, traceback, version):
>> ++>>>>>>> pep8 cleanup for root.py
>> data = {'code': status, 'reason': message,
>> 'call_stack': cherrypy._cperror.format_exc()}
>> res = template.render('error.html', data)
>>
>> $ git add src/kimchi/root.py
>> [shhfeng at localhost kimchi]$ git diff
>> [shhfeng at localhost kimchi]$ git rebase --continue
>> Applying: pep8 cleanup for root.py
>> No changes - did you forget to use 'git add'?
> 
>> If there is nothing left to stage, chances are that something else
>> already introduced the same changes; you might want to skip this patch.
> 
> 
> You should use "git rebase --skip" as you have already added the file
> 

As we found out, it seems there was a non-linear change in the upstream
master. It might be caused by reset or rebase.

Generally speaking, it would be a bad thing for a public upstream
containing non-linear change. The link [1] explained why rebase is not
welcome on public branch, and it applies to reset as well.

I thought in this case, we should have submitted a git revert firstly to
undo the patch, then we would have got a "delta" and an "anti-delta"
commit that counteract each other. At last we should have submitted a
new and correct version of this patch, so that the upstream history
would have been linear. It's very usual that we have broken patches in
upstream, and either new patch or just a revert commit would be the cure.

Now that the non-linear history is almost fetched by everyone and I have
also reset my local master, I suggest we do nothing to avoid generating
non-linear history twice.

[1] http://git-scm.com/book/en/Git-Branching-Rebasing#The-Perils-of-Rebasing

>>
>> When you have resolved this problem, run "git rebase --continue".
>> If you prefer to skip this patch, run "git rebase --skip" instead.
>> To check out the original branch and stop rebasing, run "git rebase
>> --abort".
>>
>>
>>
>> On 12/21/2013 05:18 AM, Rodrigo Trujillo wrote:
>>>
>>> Reviewed-by: Rodrigo Trujillo <rodrigo.trujillo at linux.vnet.ibm.com>
>>>
>>> On 12/20/2013 12:36 PM, Aline Manera wrote:
>>>> From: Aline Manera <alinefm at br.ibm.com>
>>>>
>>>> This patch cleans up pep8 style issue in root.py
>>>>
>>>> Also move error_production_handler and error_development_handler
>>>> functions
>>>> to Root() class as they are used only in it.
>>>>
>>>> Signed-off-by: Aline Manera <alinefm at br.ibm.com>
>>>> ---
>>>> Makefile.am | 1 +
>>>> src/kimchi/root.py | 49
>>>> +++++++++++++++++++++++++++----------------------
>>>> 2 files changed, 28 insertions(+), 22 deletions(-)
>>>>
>>>> diff --git a/Makefile.am b/Makefile.am
>>>> index e57d3b6..622d4f0 100644
>>>> --- a/Makefile.am
>>>> +++ b/Makefile.am
>>>> @@ -41,6 +41,7 @@ PEP8_WHITELIST = \
>>>> src/kimchi/asynctask.py \
>>>> src/kimchi/config.py.in \
>>>> src/kimchi/disks.py \
>>>> + src/kimchi/root.py \
>>>> src/kimchi/server.py \
>>>> plugins/__init__.py \
>>>> plugins/sample/__init__.py \
>>>> diff --git a/src/kimchi/root.py b/src/kimchi/root.py
>>>> index c43897c..d1fe818 100644
>>>> --- a/src/kimchi/root.py
>>>> +++ b/src/kimchi/root.py
>>>> @@ -19,7 +19,7 @@
>>>> #
>>>> # You should have received a copy of the GNU Lesser General Public
>>>> # License along with this library; if not, write to the Free Software
>>>> -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
>>>> 02110-1301 USA
>>>> +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
>>>> 02110-1301 USA
>>>>
>>>> import cherrypy
>>>> import json
>>>> @@ -30,30 +30,19 @@ from kimchi import template
>>>> from kimchi.config import get_api_schema_file
>>>>
>>>>
>>>> -def error_production_handler(status, message, traceback, version):
>>>> - data = {'code': status, 'reason': message}
>>>> - res = template.render('error.html', data)
>>>> - if type(res) is unicode:
>>>> - res = res.encode("utf-8")
>>>> - return res
>>>> -
>>>> -def error_development_handler(status, message, traceback, version):
>>>> - data = {'code': status, 'reason': message, 'call_stack':
>>>> cherrypy._cperror.format_exc()}
>>>> - res = template.render('error.html', data)
>>>> - if type(res) is unicode:
>>>> - res = res.encode("utf-8")
>>>> - return res
>>>> -
>>>> -
>>>> class Root(controller.Resource):
>>>> - _handled_error = ['error_page.400',
>>>> - 'error_page.404', 'error_page.405',
>>>> - 'error_page.406', 'error_page.415', 'error_page.500']
>>>> def __init__(self, model, dev_env):
>>>> + self._handled_error = ['error_page.400', 'error_page.404',
>>>> + 'error_page.405', 'error_page.406',
>>>> + 'error_page.415', 'error_page.500']
>>>> +
>>>> if not dev_env:
>>>> - self._cp_config = dict([(key, error_production_handler) for key in
>>>> self._handled_error])
>>>> + self._cp_config = dict([(key, self.error_production_handler)
>>>> + for key in self._handled_error])
>>>> else:
>>>> - self._cp_config = dict([(key, error_development_handler) for key
>>>> in self._handled_error])
>>>> + self._cp_config = dict([(key, self.error_development_handler)
>>>> + for key in self._handled_error])
>>>> +
>>>> controller.Resource.__init__(self, model)
>>>> self.vms = controller.VMs(model)
>>>> self.templates = controller.Templates(model)
>>>> @@ -69,6 +58,21 @@ class Root(controller.Resource):
>>>> self.plugins = controller.Plugins(model)
>>>> self.api_schema = json.load(open(get_api_schema_file()))
>>>>
>>>> + def error_production_handler(status, message, traceback, version):
>>>> + data = {'code': status, 'reason': message}
>>>> + res = template.render('error.html', data)
>>>> + if type(res) is unicode:
>>>> + res = res.encode("utf-8")
>>>> + return res
>>>> +
>>>> + def error_development_handler(status, message, traceback, version):
>>>> + data = {'code': status, 'reason': message,
>>>> + 'call_stack': cherrypy._cperror.format_exc()}
>>>> + res = template.render('error.html', data)
>>>> + if type(res) is unicode:
>>>> + res = res.encode("utf-8")
>>>> + return res
>>>> +
>>>> def get(self):
>>>> return self.default('kimchi-ui.html')
>>>>
>>>> @@ -77,8 +81,9 @@ class Root(controller.Resource):
>>>> if page.endswith('.html'):
>>>> return template.render(page, None)
>>>> raise cherrypy.HTTPError(404)
>>>> +
>>>> @cherrypy.expose
>>>> def tabs(self, page, **kwargs):
>>>> if page.endswith('.html'):
>>>> - return template.render('tabs/'+ page, None)
>>>> + return template.render('tabs/' + page, None)
>>>> raise cherrypy.HTTPError(404)
>>>
>>> _______________________________________________
>>> Kimchi-devel mailing list
>>> Kimchi-devel at ovirt.org
>>> http://lists.ovirt.org/mailman/listinfo/kimchi-devel
>>>
>>>
>>
>>
> 
> _______________________________________________
> Kimchi-devel mailing list
> Kimchi-devel at ovirt.org
> http://lists.ovirt.org/mailman/listinfo/kimchi-devel
> 


-- 
Thanks and best regards!

Zhou Zheng Sheng / 周征晟
E-mail: zhshzhou at linux.vnet.ibm.com
Telephone: 86-10-82454397




More information about the Kimchi-devel mailing list