Mercurial > public > mercurial-scm > hg
comparison mercurial/scmutil.py @ 14482:58b36e9ea783
introduce new function scmutil.readrequires
for reading and parsing the .hg/requires file
author | Adrian Buehlmann <adrian@cadifra.com> |
---|---|
date | Tue, 31 May 2011 19:16:18 +0200 |
parents | 5f6090e559fa |
children | 973959fbe8ec |
comparison
equal
deleted
inserted
replaced
14481:b2ee161328e0 | 14482:58b36e9ea783 |
---|---|
689 % (repo.pathto(origsrc, cwd), repo.pathto(dst, cwd))) | 689 % (repo.pathto(origsrc, cwd), repo.pathto(dst, cwd))) |
690 if repo.dirstate[dst] in '?r' and not dryrun: | 690 if repo.dirstate[dst] in '?r' and not dryrun: |
691 wctx.add([dst]) | 691 wctx.add([dst]) |
692 elif not dryrun: | 692 elif not dryrun: |
693 wctx.copy(origsrc, dst) | 693 wctx.copy(origsrc, dst) |
694 | |
695 def readrequires(opener, supported): | |
696 '''Reads and parses .hg/requires and checks if all entries found | |
697 are in the list of supported features.''' | |
698 requirements = set(opener.read("requires").splitlines()) | |
699 for r in requirements: | |
700 if r not in supported: | |
701 raise error.RequirementError( | |
702 _("requirement '%s' not supported") % r) | |
703 return requirements |