Merge lp:~ed-marsfire/bzr/giveback into lp:bzr
| Status: | Merged |
|---|---|
| Merged at revision: | not available |
| Proposed branch: | lp:~ed-marsfire/bzr/giveback |
| Merge into: | lp:bzr |
| Diff against target: |
51 lines (+12/-13) 1 file modified
bzrlib/builtins.py (+12/-13) |
| To merge this branch: | bzr merge lp:~ed-marsfire/bzr/giveback |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Martin Pool | 2010-01-28 | Approve on 2010-02-05 | |
|
Review via email:
|
|||
| EdB (ed-marsfire) wrote : | # |
| EdB (ed-marsfire) wrote : | # |
Oh forgot to mention, I've updated my UIFactory so that it has all the new methods, and it handles the make_output_stream nicely, which now maps into my UI. I used this to test the new changes and all output went to my UI. Yay!
| Martin Pool (mbp) wrote : | # |
That looks great to me. Did you try testing it?
--
Martin <http://
- 4990. By Ed Bayiates <email address hidden> on 2010-01-28
-
Bug fix to previous modifications
| EdB (ed-marsfire) wrote : | # |
I had tested it with my UI and did not notice two small failures, that I just found testing it with Python directly, which I have fixed and pushed a new update. I used this script to test it in Python:
import sys
import bzrlib
import bzrlib.ui
import bzrlib.ui.text
import bzrlib.builtins
bzrlib.
uncommit = bzrlib.
uncommit.
The newest merge has two small changes and should work fine.
| Martin Pool (mbp) wrote : | # |
I meant to suggest you should try it by running
'bzr selftest uncommit'
--
Martin <http://
| EdB (ed-marsfire) wrote : | # |
I don't understand. That would run the Windows installed version, not the Python installed in site-packages. Is there some way to have the bzr commandline command use the site-packages? It doesn't right now. I installed the Windows installer to get the bzr command line, and the Python installer to get the Python code so I could integrate with Bazaar.
Just to make sure I tried it and got this error:
bzr: ERROR: No module named tests
You may need to install this Python library separately.
Sorry if I am so ignorant -- though I have 25 years of software development experience, I am very new to Python and Bazaar development.
| John A Meinel (jameinel) wrote : | # |
C:\Python26\python C:\Python26\
However, we often just run bzr directly from the source tree, which would be closer to
C:\Python26\python .\bzr selftest uncommit
Though you may also be running into the dependencies now needed to run the test suite. I usually use 'setuptools' to install and do:
C:\Python26\python C:\Python26\
(You haven to have previously installed easy_install, though...)
The other option is:
bzr branch lp:testtools
cd testtools
C:\Python26\python setup.py install
(You need testtools >= 0.9.2)
| Martin Pool (mbp) wrote : | # |
I think this will probably find some test failures because of some
output moving from stdout to stderr. However those things can be a
bit annoying to find and fix, so don't necessarily feel obliged to run
and fix the tests. I, or the patch pilot, will try to fix them up and
merge this sometime soon. It is useful to get set up to run selftest
though, because it does help a lot in making sure your changes are ok.
--
Martin <http://
| EdB (ed-marsfire) wrote : | # |
Wow, that bzr script is neat! I set up the tests as John explains and got 1 failure, I think from what Martin said it's because of the stdout/stderr thing. Here is the total log:
C:\Python26\
bzr: WARNING: bzrlib version doesn't match the bzr program.
This may indicate an installation problem.
bzrlib from ['C:\\Python26\
QBzr: skip module bzrlib.
QBzr: skip module bzrlib.
QBzr: skip module bzrlib.
bzr selftest: C:/Python26/
C:\Python26\
bzr-2.2.0dev1 python-2.6.4 Windows-
=======
FAIL: bzrlib.
-------
_StringException: Text attachment: log
------------
74.777 creating repository in file://
74.849 creating branch <bzrlib.
74.963 opening working tree 'C:/windows/
75.137 preparing to commit
INFO Committing to: C:/windows/
75.141 Selecting files for commit with filter None
INFO added a
INFO added b
INFO added c
INFO Committed revision 1.
75.370 preparing to commit
INFO Committing to: C:/windows/
75.374 Selecting files for commit with filter None
INFO modified a
INFO Committed revision 2.
75.530 run bzr: ['uncommit', '--force']
75.530 bazaar version: 2.2.0dev1
75.530 bzr arguments: ['uncommit', '--force']
75.532 encoding stdout as sys.stdout encoding 'cp1252'
75.536 opening working tree 'C:/windows/
75.601 encoding stdout as sys.stdout encoding 'cp1252'
75.603 Uncommitting from {a2} to {a2}
75.671 output:
' 2 bayiatee\
------------
Text attachment: traceback
------------
Traceback (most recent call last):
File "C:\Python26\
line 129, in _run_user
return fn(*args)
File "C:\Python26\
testMethod()
File "C:\Python26\
self.
AssertionError: pattern "You can restore the old tip by...
| Ian Clatworthy (ian-clatworthy) wrote : | # |
EdB wrote:
> Wow, that bzr script is neat! I set up the tests as John explains and got 1 failure, I think from what Martin said it's because of the stdout/stderr thing. Here is the total log:
Well done!
> C:\Python26\
[snip]
> FAILED (failures=1)
Given you've come this far, I assume you're keen to try fixing this
yourself? If you need assistance, just let us know.
Ian C.
(Patch pilot this week)
| EdB (ed-marsfire) wrote : | # |
Do you want me to fix the test, meaning its expectations? Or do you want me to fix the functionality, meaning make sure that message goes to stderr?
| Martin Pool (mbp) wrote : | # |
2010/1/29 EdB <email address hidden>:
> Do you want me to fix the test, meaning its expectations? Or do you want me to fix the functionality, meaning make sure that message goes to stderr?
I think it's reasonable that the user interaction start going to
stderr (which I think your patch will do) but the test needs to be
updated to allow this.
--
Martin <http://
| Martin Pool (mbp) wrote : | # |
I'll have a go at fixing up the tests.
| Martin Pool (mbp) wrote : | # |
Here's the change I made to the test:
1- some output is expected on stdout not stderr
2- change from direct string comparison to a scriptrunner which makes it easier to read (imo)
I'll submit this.
Thanks, and good luck with the other commands.
=== modified file 'bzrlib/
--- bzrlib/
+++ bzrlib/
@@ -1,4 +1,4 @@
-# Copyright (C) 2005, 2006, 2008 Canonical Ltd
+# Copyright (C) 2005, 2006, 2008, 2010 Canonical Ltd
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -22,6 +22,7 @@
from bzrlib.bzrdir import BzrDirMetaFormat1
from bzrlib.errors import BzrError, BoundBranchOutO
from bzrlib.tests import TestCaseWithTra
+from bzrlib.tests.script import ScriptRunner
class TestUncommit(
@@ -215,11 +216,18 @@
def test_uncommit_
wt = self.create_
-
- out, err = self.run_
- self.assertCont
- self.assertCont
- self.assertCont
+
+ script = ScriptRunner()
+ script.
+$ cd tree
+$ bzr uncommit --force
+ 2 Martin Pool\t2010-02-05
+ second commit
+...
+The above revision(s) will be removed.
+You can restore the old tip by running:
+ bzr pull . -r revid:a2
+""")
def test_uncommit_
# Check that uncommit keeps the pending merges in the same order
| Martin Pool (mbp) wrote : | # |
This fails because of insufficient test isolation. I'll have a look at it but maybe not today.
File "/home/
test_
AssertionError: texts not equal:
- 2 Martin Pool 2010-02-05
+ 2 Patch Queue Manager 2010-02-05
second commit
- ...
+
The above revision(s) will be removed.
You can restore the old tip by running:
bzr pull . -r revid:a2
------------

Hi everyone,
This a second try at changing cmd_uncommit so it uses UIFactory for input/output.
Per Martin's initial review, I have fixed the branch so it uses correct line endings. I removed my output collector class and am using ui_factory. make_output_ stream( ) instead. I've changed the command so that the dry run case does not do a "press enter to continue" but instead both dry run and non-dry run do a get_boolean if not forced.
This should be much more to your liking. Review away and let me know what you think!
Cheers,
-Ed