'Updates the list of files whenever the selection changes'

def update_diff_files(self, *rest):

    (left_item, right_item) = self.selection()
    if ((not left_item) or (not right_item) or (left_item == right_item)):
        self.set_diff_files([])
        return
    left_item = self.remote_ref(left_item)
    right_item = self.remote_ref(right_item)
    if (self.SANDBOX in (left_item, right_item)):
        self.use_sandbox = True
        if (left_item == self.SANDBOX):
            self.diff_arg = (right_item,)
        else:
            self.diff_arg = (left_item,)
    else:
        self.diff_arg = (left_item, right_item)
        self.use_sandbox = False
    self.start = left_item
    self.end = right_item
    if (len(self.diff_arg) == 1):
        files = gitcmds.diff_index_filenames(self.diff_arg[0])
    else:
        files = gitcmds.diff_filenames(*self.diff_arg)
    self.set_diff_files(files)
