##// END OF EJS Templates
subrepo: use `changing_files` context in subrepository code...
marmoute -
r50941:2264e775 default
parent child Browse files
Show More
@@ -569,15 +569,20 b' class hgsubrepo(abstractsubrepo):'
569
569
570 @annotatesubrepoerror
570 @annotatesubrepoerror
571 def add(self, ui, match, prefix, uipathfn, explicitonly, **opts):
571 def add(self, ui, match, prefix, uipathfn, explicitonly, **opts):
572 return cmdutil.add(
572 # XXX Ideally, we could let the caller take the `changing_files`
573 ui,
573 # context. However this is not an abstraction that make sense for
574 self._repo,
574 # other repository types, and leaking that details purely related to
575 match,
575 # dirstate seems unfortunate. So for now the context will be used here.
576 prefix,
576 with self._repo.wlock(), self._repo.dirstate.changing_files(self._repo):
577 uipathfn,
577 return cmdutil.add(
578 explicitonly,
578 ui,
579 **opts,
579 self._repo,
580 )
580 match,
581 prefix,
582 uipathfn,
583 explicitonly,
584 **opts,
585 )
581
586
582 @annotatesubrepoerror
587 @annotatesubrepoerror
583 def addremove(self, m, prefix, uipathfn, opts):
588 def addremove(self, m, prefix, uipathfn, opts):
@@ -586,7 +591,18 b' class hgsubrepo(abstractsubrepo):'
586 # be used to process sibling subrepos however.
591 # be used to process sibling subrepos however.
587 opts = copy.copy(opts)
592 opts = copy.copy(opts)
588 opts[b'subrepos'] = True
593 opts[b'subrepos'] = True
589 return scmutil.addremove(self._repo, m, prefix, uipathfn, opts)
594 # XXX Ideally, we could let the caller take the `changing_files`
595 # context. However this is not an abstraction that make sense for
596 # other repository types, and leaking that details purely related to
597 # dirstate seems unfortunate. So for now the context will be used here.
598 with self._repo.wlock(), self._repo.dirstate.changing_files(self._repo):
599 return scmutil.addremove(
600 self._repo,
601 m,
602 prefix,
603 uipathfn,
604 opts,
605 )
590
606
591 @annotatesubrepoerror
607 @annotatesubrepoerror
592 def cat(self, match, fm, fntemplate, prefix, **opts):
608 def cat(self, match, fm, fntemplate, prefix, **opts):
@@ -952,16 +968,21 b' class hgsubrepo(abstractsubrepo):'
952
968
953 @annotatesubrepoerror
969 @annotatesubrepoerror
954 def forget(self, match, prefix, uipathfn, dryrun, interactive):
970 def forget(self, match, prefix, uipathfn, dryrun, interactive):
955 return cmdutil.forget(
971 # XXX Ideally, we could let the caller take the `changing_files`
956 self.ui,
972 # context. However this is not an abstraction that make sense for
957 self._repo,
973 # other repository types, and leaking that details purely related to
958 match,
974 # dirstate seems unfortunate. So for now the context will be used here.
959 prefix,
975 with self._repo.wlock(), self._repo.dirstate.changing_files(self._repo):
960 uipathfn,
976 return cmdutil.forget(
961 True,
977 self.ui,
962 dryrun=dryrun,
978 self._repo,
963 interactive=interactive,
979 match,
964 )
980 prefix,
981 uipathfn,
982 True,
983 dryrun=dryrun,
984 interactive=interactive,
985 )
965
986
966 @annotatesubrepoerror
987 @annotatesubrepoerror
967 def removefiles(
988 def removefiles(
@@ -975,17 +996,22 b' class hgsubrepo(abstractsubrepo):'
975 dryrun,
996 dryrun,
976 warnings,
997 warnings,
977 ):
998 ):
978 return cmdutil.remove(
999 # XXX Ideally, we could let the caller take the `changing_files`
979 self.ui,
1000 # context. However this is not an abstraction that make sense for
980 self._repo,
1001 # other repository types, and leaking that details purely related to
981 matcher,
1002 # dirstate seems unfortunate. So for now the context will be used here.
982 prefix,
1003 with self._repo.wlock(), self._repo.dirstate.changing_files(self._repo):
983 uipathfn,
1004 return cmdutil.remove(
984 after,
1005 self.ui,
985 force,
1006 self._repo,
986 subrepos,
1007 matcher,
987 dryrun,
1008 prefix,
988 )
1009 uipathfn,
1010 after,
1011 force,
1012 subrepos,
1013 dryrun,
1014 )
989
1015
990 @annotatesubrepoerror
1016 @annotatesubrepoerror
991 def revert(self, substate, *pats, **opts):
1017 def revert(self, substate, *pats, **opts):
@@ -1015,7 +1041,12 b' class hgsubrepo(abstractsubrepo):'
1015 pats = [b'set:modified()']
1041 pats = [b'set:modified()']
1016 else:
1042 else:
1017 pats = []
1043 pats = []
1018 cmdutil.revert(self.ui, self._repo, ctx, *pats, **opts)
1044 # XXX Ideally, we could let the caller take the `changing_files`
1045 # context. However this is not an abstraction that make sense for
1046 # other repository types, and leaking that details purely related to
1047 # dirstate seems unfortunate. So for now the context will be used here.
1048 with self._repo.wlock(), self._repo.dirstate.changing_files(self._repo):
1049 cmdutil.revert(self.ui, self._repo, ctx, *pats, **opts)
1019
1050
1020 def shortid(self, revid):
1051 def shortid(self, revid):
1021 return revid[:12]
1052 return revid[:12]
General Comments 0
You need to be logged in to leave comments. Login now