[Pkg-bazaar-commits] r40 ./bzr-rebase/unstable: Merge 0.3.
Jelmer Vernooij
jelmer at samba.org
Thu Dec 6 15:45:06 UTC 2007
------------------------------------------------------------
revno: 40
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: debian
timestamp: Thu 2007-12-06 16:45:06 +0100
message:
Merge 0.3.
modified:
NEWS
__init__.py
rebase.py
setup.py
test_blackbox.py
test_rebase.py
------------------------------------------------------------
revno: 24.1.36
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: trunk
timestamp: Fri 2007-10-19 13:42:05 +0200
message:
Open 0.3 for development.
modified:
NEWS
__init__.py
setup.py
------------------------------------------------------------
revno: 24.1.37
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: trunk
timestamp: Tue 2007-10-23 13:59:33 +0200
message:
packs changes make revision_parents() return a tuple rather than a list.
modified:
rebase.py
------------------------------------------------------------
revno: 24.1.38
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: trunk
timestamp: Tue 2007-10-23 22:04:42 +0200
message:
Fix compatibility with packs.
modified:
rebase.py
test_rebase.py
------------------------------------------------------------
revno: 24.1.39
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: trunk
timestamp: Tue 2007-10-23 22:05:57 +0200
message:
Fix replay command, add test.
modified:
NEWS
__init__.py
test_blackbox.py
------------------------------------------------------------
revno: 24.1.40
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: trunk
timestamp: Tue 2007-10-23 22:35:19 +0200
message:
Support revision ranges to replay.
modified:
NEWS
__init__.py
test_blackbox.py
------------------------------------------------------------
revno: 24.1.41
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: trunk
timestamp: Tue 2007-10-30 23:55:35 +0100
message:
Don't require running in the branch root.
modified:
NEWS
__init__.py
------------------------------------------------------------
revno: 24.1.42
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: trunk
timestamp: Mon 2007-11-05 22:54:15 +0100
message:
Don't require use of the rebase command in root of the branch.
modified:
__init__.py
------------------------------------------------------------
revno: 24.1.43
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: trunk
timestamp: Tue 2007-11-27 13:49:44 +0000
message:
Inform user about already being rebased rather than erroring.
modified:
__init__.py
test_blackbox.py
------------------------------------------------------------
revno: 24.1.44
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: trunk
timestamp: Thu 2007-12-06 15:38:25 +0100
message:
Prefer push location over parent when rebasing.
modified:
NEWS
__init__.py
------------------------------------------------------------
revno: 24.1.45
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: trunk
timestamp: Thu 2007-12-06 16:41:41 +0100
message:
Merge some fixes.
modified:
NEWS
__init__.py
------------------------------------------------------------
revno: 24.1.43.1.1
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: trunk
timestamp: Tue 2007-11-27 15:13:40 +0000
message:
Allow use in non-root directories for rebase-continue, rebase-todo and rebase-abort.
modified:
__init__.py
------------------------------------------------------------
revno: 24.1.43.1.2
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: trunk
timestamp: Tue 2007-11-27 15:14:47 +0000
message:
Update NEWS.
modified:
NEWS
------------------------------------------------------------
revno: 24.1.46
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: trunk
timestamp: Thu 2007-12-06 16:41:50 +0100
message:
Release 0.3.
modified:
NEWS
__init__.py
-------------- next part --------------
=== modified file 'NEWS'
--- a/NEWS 2007-10-19 11:28:48 +0000
+++ b/NEWS 2007-12-06 15:41:50 +0000
@@ -1,3 +1,22 @@
+0.3 2007-12-06
+
+ ENHANCEMENTS
+
+ * "bzr replay" now supports revision ranges.
+
+ * Don't require any of the commands to be run in
+ the branch root.
+
+ * Give preference to push location when no upstream location
+ is specified.
+
+ * Make message when there is nothing to rebase a
+ bit friendlier.
+
+ BUG FIXES
+
+ * Fix "bzr replay", add test.
+
0.2 2007-10-19
BUG FIXES
=== modified file '__init__.py'
--- a/__init__.py 2007-10-19 11:28:48 +0000
+++ b/__init__.py 2007-12-06 15:41:50 +0000
@@ -27,7 +27,7 @@
UncommittedChanges)
from bzrlib.trace import info, warning
-version_info = (0, 2, 0, 'final', 0)
+version_info = (0, 3, 0, 'final', 0)
if version_info[3] == 'final':
version_string = '%d.%d.%d' % version_info[:3]
else:
@@ -117,12 +117,14 @@
workingtree_replay, write_rebase_plan,
regenerate_default_revid,
rebase_todo)
- wt = WorkingTree.open(".")
+ wt = WorkingTree.open_containing(".")[0]
wt.lock_write()
if upstream_location is None:
- upstream_location = wt.branch.get_parent()
+ upstream_location = wt.branch.get_push_location()
+ if upstream_location is None:
+ upstream_location = wt.branch.get_parent()
info("Rebasing on %s" % upstream_location)
- upstream = Branch.open(upstream_location)
+ upstream = Branch.open_containing(upstream_location)[0]
upstream_repository = upstream.repository
upstream_revision = upstream.last_revision()
try:
@@ -163,7 +165,8 @@
common_revid = find_last_common_revid(revhistory,
upstream.revision_history())
if common_revid == upstream.last_revision():
- raise BzrCommandError("Already rebased on %s" % upstream)
+ self.outf.write("No revisions to rebase.")
+ return
try:
start_revid = wt.branch.get_rev_id(
wt.branch.revision_id_to_revno(common_revid)+1)
@@ -214,7 +217,7 @@
def run(self):
from rebase import read_rebase_plan, remove_rebase_plan, complete_revert
from bzrlib.workingtree import WorkingTree
- wt = WorkingTree.open('.')
+ wt = WorkingTree.open_containing('.')[0]
wt.lock_write()
try:
# Read plan file and set last revision
@@ -240,7 +243,7 @@
read_rebase_plan, read_active_rebase_revid,
remove_rebase_plan, workingtree_replay)
from bzrlib.workingtree import WorkingTree
- wt = WorkingTree.open('.')
+ wt = WorkingTree.open_containing('.')[0]
wt.lock_write()
try:
# Abort if there are any conflicts
@@ -279,7 +282,7 @@
from rebase import (rebase_todo, read_rebase_plan,
read_active_rebase_revid)
from bzrlib.workingtree import WorkingTree
- wt = WorkingTree.open('.')
+ wt = WorkingTree.open_containing('.')[0]
wt.lock_read()
try:
try:
@@ -294,8 +297,9 @@
finally:
wt.unlock()
+
class cmd_replay(Command):
- """Replay a commit on top of a different branch.
+ """Replay commits from another branch on top of this one.
"""
@@ -305,27 +309,42 @@
def run(self, location, revision=None, merge_type=None):
from bzrlib.branch import Branch
from bzrlib.workingtree import WorkingTree
- from rebase import regenerate_default_revid, workingtree_replay
+ from bzrlib import ui
+ from rebase import regenerate_default_revid, replay_delta_workingtree
- from_branch = Branch.open(location)
+ from_branch = Branch.open_containing(location)[0]
if revision is not None:
if len(revision) == 1:
if revision[0] is not None:
- revid = revision[0].in_history(from_branch).rev_id
- else:
- raise BzrCommandError("--revision takes only one argument")
+ todo = [revision[0].in_history(from_branch).rev_id]
+ elif len(revision) == 2:
+ from_revno, from_revid = revision[0].in_history(from_branch)
+ to_revno, to_revid = revision[1].in_history(from_branch)
+ if to_revid is None:
+ to_revno = from_branch.revno()
+ todo = []
+ for revno in range(from_revno, to_revno + 1):
+ todo.append(from_branch.get_rev_id(revno))
+ else:
+ raise BzrCommandError(
+ "--revision takes only one or two arguments")
else:
raise BzrCommandError("--revision is mandatory")
wt = WorkingTree.open(".")
wt.lock_write()
+ pb = ui.ui_factory.nested_progress_bar()
try:
- wt.branch.repository.fetch(from_branch.repository, revid)
- newrevid = regenerate_default_revid(wt.branch.repository, revid)
- replay_delta_workingtree(wt, revid, newrevid, [wt.last_revision()],
- merge_type=merge_type)
+ for revid in todo:
+ pb.update("replaying commits", todo.index(revid), len(todo))
+ wt.branch.repository.fetch(from_branch.repository, revid)
+ newrevid = regenerate_default_revid(wt.branch.repository, revid)
+ replay_delta_workingtree(wt, revid, newrevid,
+ [wt.last_revision()],
+ merge_type=merge_type)
finally:
+ pb.finished()
wt.unlock()
=== modified file 'rebase.py'
--- a/rebase.py 2007-10-19 11:08:36 +0000
+++ b/rebase.py 2007-10-23 20:04:42 +0000
@@ -155,7 +155,8 @@
stop_revno = None
new_parent = onto_revid
for oldrevid in history[start_revno:stop_revno]:
- oldparents = get_parents(oldrevid)
+ oldparents = list(get_parents(oldrevid))
+ assert isinstance(oldparents, list)
assert oldparents == [] or \
oldparents[0] == history[history.index(oldrevid)-1]
if len(oldparents) > 1:
@@ -211,7 +212,7 @@
if c in renames:
continue
if replace_map.has_key(c):
- parents = replace_map[c][1]
+ parents = list(replace_map[c][1])
else:
parents = list(graph[c])
assert isinstance(parents, list), \
@@ -282,7 +283,7 @@
continue
replay_fn(repository, revid, newrevid, newparents)
assert repository.has_revision(newrevid)
- assert repository.revision_parents(newrevid) == newparents, \
+ assert list(repository.revision_parents(newrevid)) == newparents, \
"expected parents %r, got %r" % (newparents,
repository.revision_parents(newrevid))
if dependencies.has_key(newrevid):
@@ -324,7 +325,6 @@
revprops=revprops,
revision_id=newrevid)
try:
-
# Check what new_ie.file_id should be
# use old and new parent inventories to generate new_id map
fileid_map = map_file_ids(repository, oldrev.parent_ids, new_parents)
@@ -363,10 +363,10 @@
finally:
pb.finished()
builder.finish_inventory()
+ return builder.commit(oldrev.message)
except:
- builder.repository.abort_write_group()
+ builder.abort()
raise
- return builder.commit(oldrev.message)
def commit_rebase(wt, oldrev, newrevid):
=== modified file 'setup.py'
--- a/setup.py 2007-10-19 11:28:48 +0000
+++ b/setup.py 2007-10-19 11:42:05 +0000
@@ -5,7 +5,7 @@
setup(name='bzr-rebase',
description='Rebase plugin for Bazaar',
keywords='plugin bzr rebase',
- version='0.2',
+ version='0.3',
url='http://bazaar-vcs.org/Rebase',
download_url='http://bazaar-vcs.org/Rebase',
license='GPL',
=== modified file 'test_blackbox.py'
--- a/test_blackbox.py 2007-10-18 21:59:50 +0000
+++ b/test_blackbox.py 2007-11-27 13:49:44 +0000
@@ -40,8 +40,7 @@
def test_notneeded(self):
os.chdir('../feature')
- self.run_bzr_error(['bzr: ERROR: Already rebased on .*'],
- 'rebase ../main')
+ self.check_output('No revisions to rebase.', 'rebase ../main')
def test_simple_success(self):
self.make_file('hello', '42')
@@ -177,3 +176,45 @@
self.run_bzr('merge')
self.run_bzr('commit -m merge')
self.run_bzr('rebase')
+
+class ReplayTests(ExternalBase):
+ def test_replay(self):
+ os.mkdir('main')
+ os.chdir('main')
+ self.run_bzr('init')
+ open('bar', 'w').write('42')
+ self.run_bzr('add')
+ self.run_bzr('commit -m that')
+ os.mkdir('../feature')
+ os.chdir('../feature')
+ self.run_bzr('init')
+ branch = Branch.open('.')
+ open('hello', 'w').write("my data")
+ self.run_bzr('add')
+ self.run_bzr('commit -m this')
+ self.assertEquals(1, len(branch.revision_history()))
+ self.run_bzr('replay -r1 ../main')
+ self.assertEquals(2, len(branch.revision_history()))
+ self.assertTrue(os.path.exists('bar'))
+
+class ReplayTests(ExternalBase):
+ def test_replay(self):
+ os.mkdir('main')
+ os.chdir('main')
+ self.run_bzr('init')
+ open('bar', 'w').write('42')
+ self.run_bzr('add')
+ self.run_bzr('commit -m that')
+ open('bar', 'w').write('84')
+ self.run_bzr('commit -m blathat')
+ os.mkdir('../feature')
+ os.chdir('../feature')
+ self.run_bzr('init')
+ branch = Branch.open('.')
+ open('hello', 'w').write("my data")
+ self.run_bzr('add')
+ self.run_bzr('commit -m this')
+ self.assertEquals(1, len(branch.revision_history()))
+ self.run_bzr('replay -r1.. ../main')
+ self.assertEquals(3, len(branch.revision_history()))
+ self.assertTrue(os.path.exists('bar'))
=== modified file 'test_rebase.py'
--- a/test_rebase.py 2007-10-19 10:39:24 +0000
+++ b/test_rebase.py 2007-10-23 20:04:42 +0000
@@ -505,9 +505,11 @@
wt.add(["afile"], ids=["newid"])
wt.commit("bla", rev_id="newparent")
wt.branch.repository.fetch(oldrepos)
+ wt.lock_write()
self.assertRaises(ConflictsInTree,
replay_delta_workingtree, wt, "oldcommit", "newcommit",
["newparent"])
+ wt.unlock()
def test_simple(self):
wt = self.make_branch_and_tree("old")
@@ -521,8 +523,10 @@
self.build_tree(['new/bfile'])
wt.add(["bfile"], ids=["newid"])
wt.commit("bla", rev_id="newparent")
+ wt.lock_write()
replay_delta_workingtree(wt, "oldcommit", "newcommit",
["newparent"])
+ wt.unlock()
oldrev = wt.branch.repository.get_revision("oldcommit")
newrev = wt.branch.repository.get_revision("newcommit")
self.assertEquals(["newparent"], newrev.parent_ids)
@@ -543,8 +547,10 @@
self.build_tree(['new/bfile'])
wt.add(["bfile"], ids=["newid"])
wt.commit("bla", rev_id="newparent")
+ wt.lock_write()
replay_delta_workingtree(wt, "oldcommit", "newcommit",
["newparent", "ghost"])
+ wt.unlock()
oldrev = wt.branch.repository.get_revision("oldcommit")
newrev = wt.branch.repository.get_revision("newcommit")
self.assertEquals(["newparent", "ghost"], newrev.parent_ids)
@@ -594,12 +600,16 @@
newwt.add_pending_merge("B")
newwt.commit("bla", rev_id="E")
newwt.branch.repository.fetch(oldwt.branch.repository)
+ newwt.lock_write()
replay_delta_workingtree(newwt, "D", "D'", ["C"])
+ newwt.unlock()
oldrev = newwt.branch.repository.get_revision("D")
newrev = newwt.branch.repository.get_revision("D'")
self.assertEquals(["C"], newrev.parent_ids)
+ newwt.lock_write()
self.assertRaises(ConflictsInTree,
lambda: replay_delta_workingtree(newwt, "E", "E'", ["D'"]))
+ newwt.unlock()
self.assertEquals("E\n" + "A\n" * 10 + "C\n",
open("new/afile", 'r').read())
newwt.set_conflicts(ConflictList())
More information about the Pkg-bazaar-commits
mailing list