~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/branch.py

  • Committer: Martin Pool
  • Date: 2005-05-10 08:15:58 UTC
  • Revision ID: mbp@sourcefrog.net-20050510081558-9a38e2c46ba4ebc4
- Patch from Fredrik Lundh to check Python version and 
  try to find a better one if it's too old.

  Patched to try to prevent infinite loops in wierd configurations,
  and to log to stderr.

Show diffs side-by-side

added added

removed removed

Lines of Context:
40
40
 
41
41
 
42
42
 
 
43
def find_branch(f, **args):
 
44
    if f.startswith('http://') or f.startswith('https://'):
 
45
        import remotebranch 
 
46
        return remotebranch.RemoteBranch(f, **args)
 
47
    else:
 
48
        return Branch(f, **args)
 
49
        
 
50
 
43
51
def find_branch_root(f=None):
44
52
    """Find the branch root enclosing f, or pwd.
45
53
 
 
54
    f may be a filename or a URL.
 
55
 
46
56
    It is not necessary that f exists.
47
57
 
48
58
    Basically we keep looking up until we find the control directory or
53
63
        f = os.path.realpath(f)
54
64
    else:
55
65
        f = os.path.abspath(f)
 
66
    if not os.path.exists(f):
 
67
        raise BzrError('%r does not exist' % f)
 
68
        
56
69
 
57
70
    orig_f = f
58
71
 
200
213
        and binary.  binary files are untranslated byte streams.  Text
201
214
        control files are stored with Unix newlines and in UTF-8, even
202
215
        if the platform or locale defaults are different.
 
216
 
 
217
        Controlfiles should almost never be opened in write mode but
 
218
        rather should be atomically copied and replaced using atomicfile.
203
219
        """
204
220
 
205
221
        fn = self.controlfilename(file_or_path)
906
922
 
907
923
 
908
924
 
909
 
    def show_status(self, show_all=False):
 
925
    def show_status(self, show_all=False, file_list=None):
910
926
        """Display single-line status for non-ignored working files.
911
927
 
912
928
        The list is show sorted in order by file name.
922
938
        >>> os.unlink(b.abspath('foo'))
923
939
        >>> b.show_status()
924
940
        D       foo
925
 
        
926
 
        TODO: Get state for single files.
927
941
        """
928
942
        self._need_readlock()
929
943
 
939
953
        old = self.basis_tree()
940
954
        new = self.working_tree()
941
955
 
942
 
        for fs, fid, oldname, newname, kind in diff_trees(old, new):
 
956
        items = diff_trees(old, new)
 
957
        # We want to filter out only if any file was provided in the file_list.
 
958
        if isinstance(file_list, list) and len(file_list):
 
959
            items = [item for item in items if item[3] in file_list]
 
960
 
 
961
        for fs, fid, oldname, newname, kind in items:
943
962
            if fs == 'R':
944
963
                show_status(fs, kind,
945
964
                            oldname + ' => ' + newname)