def status(self, updates=0, rec=0, externals=0): |
""" return (collective) Status object for this file. """ |
|
|
|
if externals: |
raise ValueError("XXX cannot perform status() " |
"on external items yet") |
else: |
|
externals = '' |
if rec: |
rec= '' |
else: |
rec = '--non-recursive' |
|
|
|
|
|
if updates: |
updates = '-u' |
else: |
updates = '' |
|
update_rev = None |
|
out = self._svn('status -v %s %s %s' % (updates, rec, externals)) |
rootstatus = WCStatus(self) |
for line in out.split('\n'): |
if not line.strip(): |
continue |
|
flags, rest = line[:8], line[8:] |
|
c0,c1,c2,c3,c4,x5,x6,c7 = flags |
|
|
|
if c0 in '?XI': |
fn = line.split(None, 1)[1] |
if c0 == '?': |
wcpath = self.join(fn, abs=1) |
rootstatus.unknown.append(wcpath) |
elif c0 == 'X': |
wcpath = self.__class__(self.localpath.join(fn, abs=1)) |
rootstatus.external.append(wcpath) |
elif c0 == 'I': |
wcpath = self.join(fn, abs=1) |
rootstatus.ignored.append(wcpath) |
|
continue |
|
|
|
|
m = self._rex_status.match(rest) |
if not m: |
if c7 == '*': |
fn = rest.strip() |
wcpath = self.join(fn, abs=1) |
rootstatus.update_available.append(wcpath) |
continue |
if line.lower().find('against revision:')!=-1: |
update_rev = int(rest.split(':')[1].strip()) |
continue |
|
raise ValueError, "could not parse line %r" % line |
else: |
rev, modrev, author, fn = m.groups() |
-> wcpath = self.join(fn, abs=1) |
|
if c0 == 'M': |
assert wcpath.check(file=1), "didn't expect a directory with changed content here" |
rootstatus.modified.append(wcpath) |
elif c0 == 'A' or c3 == '+' : |
rootstatus.added.append(wcpath) |
elif c0 == 'D': |
rootstatus.deleted.append(wcpath) |
elif c0 == 'C': |
rootstatus.conflict.append(wcpath) |
elif c0 == '~': |
rootstatus.kindmismatch.append(wcpath) |
elif c0 == '!': |
rootstatus.incomplete.append(wcpath) |
elif not c0.strip(): |
rootstatus.unchanged.append(wcpath) |
else: |
raise NotImplementedError("received flag %r" % c0) |
|
if c1 == 'M': |
rootstatus.prop_modified.append(wcpath) |
if c2 == 'L': |
rootstatus.locked.append(wcpath) |
if c7 == '*': |
rootstatus.update_available.append(wcpath) |
|
if wcpath == self: |
rootstatus.rev = rev |
rootstatus.modrev = modrev |
rootstatus.author = author |
if update_rev: |
rootstatus.update_rev = update_rev |
continue |
return rootstatus |