b.s.Shelver(object) : class documentation

Part of bzrlib.shelf_ui View In Hierarchy

Known subclasses: bzrlib.tests.test_shelf_ui.ExpectShelver

Interactively shelve the changes in a working tree.
Method __init__ Constructor.
Class Method from_args Create a shelver from commandline arguments.
Method run Interactively shelve the changes.
Method finalize Undocumented
Method get_parsed_patch Return a parsed version of a file's patch.
Method prompt Undocumented
Method prompt_bool Prompt the user with a yes/no question.
Method handle_modify_text Handle modified text, by using hunk selection or file editing.
Method _select_hunks Provide diff hunk selection for modified text.
Method _edit_file
Static Method _count_changed_regions Undocumented
def __init__(self, work_tree, target_tree, diff_writer=None, auto=False, auto_apply=False, file_list=None, message=None, destroy=False, manager=None, reporter=None):
Constructor.
Parameterswork_treeThe working tree to shelve changes from.
target_treeThe "unchanged" / old tree to compare the work_tree to.
autoIf True, shelve each possible change.
auto_applyIf True, shelve changes with no final prompt.
file_listIf supplied, only files in this list may be shelved.
messageThe message to associate with the shelved changes.
destroyChange the working tree without storing the shelved changes.
managerThe shelf manager to use.
reporterObject for reporting changes to user.
@classmethod
def from_args(klass, diff_writer, revision=None, all=False, file_list=None, message=None, directory=None, destroy=False):
Create a shelver from commandline arguments.

The returned shelver wil have a work_tree that is locked and should be unlocked.

ParametersrevisionRevisionSpec of the revision to compare to.
allIf True, shelve all changes without prompting.
file_listIf supplied, only files in this list may be shelved.
messageThe message to associate with the shelved changes.
directoryThe directory containing the working tree.
destroyChange the working tree without storing the shelved changes.
def run(self):
Interactively shelve the changes.
def finalize(self):
Undocumented
def get_parsed_patch(self, file_id, invert=False):
Return a parsed version of a file's patch.
Parametersfile_idThe id of the file to generate a patch for.
invertIf True, provide an inverted patch (insertions displayed as removals, removals displayed as insertions).
ReturnsA patches.Patch.
def prompt(self, message, choices, default):
Undocumented
def prompt_bool(self, question, allow_editor=False):
Prompt the user with a yes/no question.

This may be overridden by self.auto. It may also set self.auto. It may also raise UserAbort. :param question: The question to ask the user. :return: True or False

def handle_modify_text(self, creator, file_id):
Handle modified text, by using hunk selection or file editing.
ParameterscreatorA ShelfCreator.
file_idThe id of the file that was modified.
ReturnsThe number of changes.
def _select_hunks(self, creator, file_id, work_tree_lines):
Provide diff hunk selection for modified text.

If self.reporter.invert_diff is True, the diff is inverted so that insertions are displayed as removals and vice versa.

Parameterscreatora ShelfCreator
file_idThe id of the file to shelve.
work_tree_linesLine contents of the file in the working tree.
Returnsnumber of shelved hunks.
def _edit_file(self, file_id, work_tree_lines):
Parametersfile_idid of the file to edit.
work_tree_linesLine contents of the file in the working tree.
Returns(lines, change_region_count), where lines is the new line content of the file, and change_region_count is the number of changed regions.
@staticmethod
def _count_changed_regions(old_lines, new_lines):
Undocumented
API Documentation for Bazaar, generated by pydoctor at 2022-06-16 00:25:16.