comparison mercurial/subrepo.py @ 16554:ae2664ee0223 stable

subrepo/svn: fix checked out rev number retrieval (issue2968) The initial version was to take the "Revision" field from svn info. It works but produces false positive when parent paths are being moved or unrelated changes are being committed, causing it to change while the svn checkout itself remains the same. To avoid spurious commit, we took "Revision" and "Last Changed Rev" for general comparison and kept the latter to answer "what is your revision?" question. This is better but fails when the subrepo path exists at "Revision" but not at "Last Changed Rev". This patch adds a check for this, and returns "Revision" if the path does not exist. We try to avoid doing this as much as possible at it implies an extra, *remote* call.
author Patrick Mezard <patrick@mezard.eu>
date Mon, 30 Apr 2012 17:03:15 +0200
parents e37199a1f9d4
children 4955e7bf085c
comparison
equal deleted inserted replaced
16553:9224cc2e99cc 16554:ae2664ee0223
713 if self._state[1] in self._wcrevs() or ignoreupdate: 713 if self._state[1] in self._wcrevs() or ignoreupdate:
714 return False 714 return False
715 return True 715 return True
716 716
717 def basestate(self): 717 def basestate(self):
718 return self._wcrev() 718 lastrev, rev = self._wcrevs()
719 if lastrev != rev:
720 # Last committed rev is not the same than rev. We would
721 # like to take lastrev but we do not know if the subrepo
722 # URL exists at lastrev. Test it and fallback to rev it
723 # is not there.
724 try:
725 self._svncommand(['info', '%s@%s' % (self._state[0], lastrev)])
726 return lastrev
727 except error.Abort:
728 pass
729 return rev
719 730
720 def commit(self, text, user, date): 731 def commit(self, text, user, date):
721 # user and date are out of our hands since svn is centralized 732 # user and date are out of our hands since svn is centralized
722 changed, extchanged, missing = self._wcchanged() 733 changed, extchanged, missing = self._wcchanged()
723 if not changed: 734 if not changed:
724 return self._wcrev() 735 return self.basestate()
725 if extchanged: 736 if extchanged:
726 # Do not try to commit externals 737 # Do not try to commit externals
727 raise util.Abort(_('cannot commit svn externals')) 738 raise util.Abort(_('cannot commit svn externals'))
728 if missing: 739 if missing:
729 # svn can commit with missing entries but aborting like hg 740 # svn can commit with missing entries but aborting like hg