##// END OF EJS Templates
subrepo/svn: improve error message on missing files...
Patrick Mezard -
r16530:e37199a1 stable
parent child Browse files
Show More
@@ -680,12 +680,13 class svnsubrepo(abstractsubrepo):
680 680 return self._wcrevs()[0]
681 681
682 682 def _wcchanged(self):
683 """Return (changes, extchanges) where changes is True
684 if the working directory was changed, and extchanges is
685 True if any of these changes concern an external entry.
683 """Return (changes, extchanges, missing) where changes is True
684 if the working directory was changed, extchanges is
685 True if any of these changes concern an external entry and missing
686 is True if any change is a missing entry.
686 687 """
687 688 output, err = self._svncommand(['status', '--xml'])
688 externals, changes = [], []
689 externals, changes, missing = [], [], []
689 690 doc = xml.dom.minidom.parseString(output)
690 691 for e in doc.getElementsByTagName('entry'):
691 692 s = e.getElementsByTagName('wc-status')
@@ -696,14 +697,16 class svnsubrepo(abstractsubrepo):
696 697 path = e.getAttribute('path')
697 698 if item == 'external':
698 699 externals.append(path)
700 elif item == 'missing':
701 missing.append(path)
699 702 if (item not in ('', 'normal', 'unversioned', 'external')
700 703 or props not in ('', 'none', 'normal')):
701 704 changes.append(path)
702 705 for path in changes:
703 706 for ext in externals:
704 707 if path == ext or path.startswith(ext + os.sep):
705 return True, True
706 return bool(changes), False
708 return True, True, bool(missing)
709 return bool(changes), False, bool(missing)
707 710
708 711 def dirty(self, ignoreupdate=False):
709 712 if not self._wcchanged()[0]:
@@ -716,12 +719,16 class svnsubrepo(abstractsubrepo):
716 719
717 720 def commit(self, text, user, date):
718 721 # user and date are out of our hands since svn is centralized
719 changed, extchanged = self._wcchanged()
722 changed, extchanged, missing = self._wcchanged()
720 723 if not changed:
721 724 return self._wcrev()
722 725 if extchanged:
723 726 # Do not try to commit externals
724 727 raise util.Abort(_('cannot commit svn externals'))
728 if missing:
729 # svn can commit with missing entries but aborting like hg
730 # seems a better approach.
731 raise util.Abort(_('cannot commit missing svn entries'))
725 732 commitinfo, err = self._svncommand(['commit', '-m', text])
726 733 self._ui.status(commitinfo)
727 734 newrev = re.search('Committed revision ([0-9]+).', commitinfo)
@@ -773,7 +780,7 class svnsubrepo(abstractsubrepo):
773 780 status, err = self._svncommand(args, failok=True)
774 781 if not re.search('Checked out revision [0-9]+.', status):
775 782 if ('is already a working copy for a different URL' in err
776 and (self._wcchanged() == (False, False))):
783 and (self._wcchanged()[:2] == (False, False))):
777 784 # obstructed but clean working copy, so just blow it away.
778 785 self.remove()
779 786 self.get(state, overwrite=False)
@@ -125,7 +125,7 missing svn file, commit should fail
125 125 $ rm s/alpha
126 126 $ hg commit --subrepos -m 'abort on missing file'
127 127 committing subrepository s
128 abort: failed to commit svn changes
128 abort: cannot commit missing svn entries
129 129 [255]
130 130 $ svn revert s/alpha > /dev/null
131 131
General Comments 0
You need to be logged in to leave comments. Login now