Merge lp:~jelmer/brz/workspace-improvements into lp:brz

Proposed by Jelmer Vernooij
Status: Merged
Approved by: Jelmer Vernooij
Approved revision: no longer in the source branch.
Merge reported by: The Breezy Bot
Merged at revision: not available
Proposed branch: lp:~jelmer/brz/workspace-improvements
Merge into: lp:brz
Diff against target: 82 lines (+18/-15)
1 file modified
breezy/workspace.py (+18/-15)
To merge this branch: bzr merge lp:~jelmer/brz/workspace-improvements
Reviewer Review Type Date Requested Status
Jelmer Vernooij Approve
Review via email: mp+423531@code.launchpad.net

Commit message

Some workspace improvements.

Description of the change

Some workspace improvements.

To post a comment you must log in.
Revision history for this message
Jelmer Vernooij (jelmer) :
review: Approve
Revision history for this message
The Breezy Bot (the-breezy-bot) wrote :

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'breezy/workspace.py'
2--- breezy/workspace.py 2022-01-17 01:57:16 +0000
3+++ breezy/workspace.py 2022-05-27 13:43:06 +0000
4@@ -26,9 +26,9 @@
5 import errno
6 import os
7 import shutil
8-from typing import Optional
9-
10-
11+from typing import Optional, List
12+
13+from .clean_tree import iter_deletables
14 from .errors import BzrError, DependencyNotPresent, NoSuchFile
15 from .osutils import is_inside
16 from .trace import warning
17@@ -40,8 +40,10 @@
18 class WorkspaceDirty(BzrError):
19 _fmt = "The directory %(path)s has pending changes."
20
21- def __init__(self, path):
22- BzrError.__init__(self, path=path)
23+ def __init__(self, tree, subpath):
24+ self.tree = tree
25+ self.subpath = subpath
26+ BzrError.__init__(self, path=tree.abspath(subpath))
27
28
29 # TODO(jelmer): Move to .clean_tree?
30@@ -145,7 +147,7 @@
31 for change in changes
32 if relevant(change.path[0], basis_tree) or relevant(change.path[1], local_tree)
33 ):
34- raise WorkspaceDirty(local_tree.abspath(subpath))
35+ raise WorkspaceDirty(local_tree, subpath)
36
37
38 def get_dirty_tracker(local_tree, subpath='', use_inotify=None):
39@@ -213,7 +215,7 @@
40 if self._dirty_tracker is not None:
41 self._dirty_tracker.mark_clean()
42
43- def _stage(self):
44+ def _stage(self) -> List[str]:
45 if self._dirty_tracker:
46 relpaths = self._dirty_tracker.relpaths()
47 # Sort paths so that directories get added before the files they
48@@ -222,12 +224,19 @@
49 [p for p in sorted(relpaths)
50 if self.tree.has_filename(p) and not
51 self.tree.is_ignored(p)])
52- return [
53+ changed = [
54 p for p in relpaths
55 if self.tree.is_versioned(p)]
56 else:
57 self.tree.smart_add([self.tree.abspath(self.subpath)])
58- return [self.subpath] if self.subpath else None
59+ changed = [self.subpath] if self.subpath else None
60+
61+ if self.tree.supports_setting_file_ids():
62+ from .rename_map import RenameMap
63+ basis_tree = self.tree.basis_tree()
64+ RenameMap.guess_renames(
65+ basis_tree, self.tree, dry_run=False)
66+ return changed
67
68 def iter_changes(self):
69 with self.tree.lock_write():
70@@ -254,12 +263,6 @@
71 with self.tree.lock_write():
72 specific_files = self._stage()
73
74- if self.tree.supports_setting_file_ids():
75- from .rename_map import RenameMap
76- basis_tree = self.tree.basis_tree()
77- RenameMap.guess_renames(
78- basis_tree, self.tree, dry_run=False)
79-
80 kwargs['specific_files'] = specific_files
81 revid = self.tree.commit(**kwargs)
82 if self._dirty_tracker:

Subscribers

People subscribed via source and target branches