comparison mercurial/subrepo.py @ 13288:9c3bfba3f48d

Merge with stable
author Patrick Mezard <pmezard@gmail.com>
date Sat, 22 Jan 2011 16:29:10 +0100
parents a8cef95cea88 d0e0d3d43e14
children d8d478f9ee0f
comparison
equal deleted inserted replaced
13286:189edd1b15fb 13288:9c3bfba3f48d
506 stderr = stderr.strip() 506 stderr = stderr.strip()
507 if stderr: 507 if stderr:
508 raise util.Abort(stderr) 508 raise util.Abort(stderr)
509 return stdout 509 return stdout
510 510
511 def _wcrev(self): 511 def _wcrevs(self):
512 # Get the working directory revision as well as the last
513 # commit revision so we can compare the subrepo state with
514 # both. We used to store the working directory one.
512 output = self._svncommand(['info', '--xml']) 515 output = self._svncommand(['info', '--xml'])
513 doc = xml.dom.minidom.parseString(output) 516 doc = xml.dom.minidom.parseString(output)
514 entries = doc.getElementsByTagName('entry') 517 entries = doc.getElementsByTagName('entry')
515 if not entries: 518 lastrev, rev = '0', '0'
516 return '0' 519 if entries:
517 return str(entries[0].getAttribute('revision')) or '0' 520 rev = str(entries[0].getAttribute('revision')) or '0'
521 commits = entries[0].getElementsByTagName('commit')
522 if commits:
523 lastrev = str(commits[0].getAttribute('revision')) or '0'
524 return (lastrev, rev)
525
526 def _wcrev(self):
527 return self._wcrevs()[0]
518 528
519 def _wcchanged(self): 529 def _wcchanged(self):
520 """Return (changes, extchanges) where changes is True 530 """Return (changes, extchanges) where changes is True
521 if the working directory was changed, and extchanges is 531 if the working directory was changed, and extchanges is
522 True if any of these changes concern an external entry. 532 True if any of these changes concern an external entry.
542 return True, True 552 return True, True
543 return bool(changes), False 553 return bool(changes), False
544 554
545 def dirty(self, ignoreupdate=False): 555 def dirty(self, ignoreupdate=False):
546 if not self._wcchanged()[0]: 556 if not self._wcchanged()[0]:
547 if self._wcrev() == self._state[1] or ignoreupdate: 557 if self._state[1] in self._wcrevs() or ignoreupdate:
548 return False 558 return False
549 return True 559 return True
550 560
551 def commit(self, text, user, date): 561 def commit(self, text, user, date):
552 # user and date are out of our hands since svn is centralized 562 # user and date are out of our hands since svn is centralized