File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -11,12 +11,28 @@ def pull(from, &block)
11
11
run "mkdir -p '#{ self . url } '"
12
12
run "rm -rf '#{ self . url } '"
13
13
run "bzr branch '#{ from . url } ' '#{ self . url } '"
14
+ clean_up_disk
14
15
else
15
16
run "cd '#{ self . url } ' && bzr revert && bzr pull --overwrite '#{ from . url } '"
16
17
end
17
18
18
19
yield ( 1 , 1 ) if block_given? # Progress bar callback
19
20
end
20
21
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
+
21
37
end
22
38
end
You can’t perform that action at this time.
0 commit comments