Skip to content

Commit 68b9ecc

Browse files
author
Robin Luckey
committed
OTWO-1412 Upgrades Bzr repositories after every pull
We can't know when it's required, but it's fatal to miss it, So we force a `bzr upgrade` after every pull.
1 parent 4991eb4 commit 68b9ecc

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

lib/scm/adapters/bzr/pull.rb

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,28 @@ def pull(from, &block)
1111
run "mkdir -p '#{self.url}'"
1212
run "rm -rf '#{self.url}'"
1313
run "bzr branch '#{from.url}' '#{self.url}'"
14+
clean_up_disk
1415
else
1516
run "cd '#{self.url}' && bzr revert && bzr pull --overwrite '#{from.url}'"
1617
end
1718

1819
yield(1,1) if block_given? # Progress bar callback
1920
end
2021

22+
def clean_up_disk
23+
# Usually a `bzr upgrade` is unnecessary, but it's fatal to miss it when
24+
# required. Because I don't know how to detect in advance whether we
25+
# actually need it, we play it safe and always upgrade.
26+
#
27+
# Unfortunately, not only can we not know whether it is required,
28+
# but the command fails and raises when the upgrade is not required.
29+
30+
begin
31+
run "cd '#{self.url}' && bzr upgrade"
32+
rescue RuntimeError => e
33+
raise unless e.message =~ /already at the most recent format/
34+
end
35+
end
36+
2137
end
2238
end

0 commit comments

Comments
 (0)