##// END OF EJS Templates
commands: inline definition of localrepo.parents() and drop the method (API)...
Augie Fackler -
r27167:3fe8cb40 default
parent child Browse files
Show More
@@ -441,7 +441,7 b' def rebase(ui, repo, **opts):'
441 targetancestors)
441 targetancestors)
442 storestatus(repo, originalwd, target, state, collapsef, keepf,
442 storestatus(repo, originalwd, target, state, collapsef, keepf,
443 keepbranchesf, external, activebookmark)
443 keepbranchesf, external, activebookmark)
444 if len(repo.parents()) == 2:
444 if len(repo[None].parents()) == 2:
445 repo.ui.debug('resuming interrupted rebase\n')
445 repo.ui.debug('resuming interrupted rebase\n')
446 else:
446 else:
447 try:
447 try:
@@ -930,7 +930,7 b' def restorestatus(repo):'
930 def needupdate(repo, state):
930 def needupdate(repo, state):
931 '''check whether we should `update --clean` away from a merge, or if
931 '''check whether we should `update --clean` away from a merge, or if
932 somehow the working dir got forcibly updated, e.g. by older hg'''
932 somehow the working dir got forcibly updated, e.g. by older hg'''
933 parents = [p.rev() for p in repo.parents()]
933 parents = [p.rev() for p in repo[None].parents()]
934
934
935 # Are we in a merge state at all?
935 # Are we in a merge state at all?
936 if len(parents) < 2:
936 if len(parents) < 2:
@@ -1190,7 +1190,7 b' def branch(ui, repo, label=None, **opts)'
1190 ui.status(_('reset working directory to branch %s\n') % label)
1190 ui.status(_('reset working directory to branch %s\n') % label)
1191 elif label:
1191 elif label:
1192 if not opts.get('force') and label in repo.branchmap():
1192 if not opts.get('force') and label in repo.branchmap():
1193 if label not in [p.branch() for p in repo.parents()]:
1193 if label not in [p.branch() for p in repo[None].parents()]:
1194 raise error.Abort(_('a branch of the same name already'
1194 raise error.Abort(_('a branch of the same name already'
1195 ' exists'),
1195 ' exists'),
1196 # i18n: "it" refers to an existing branch
1196 # i18n: "it" refers to an existing branch
@@ -1600,8 +1600,8 b' def commit(ui, repo, *pats, **opts):'
1600 if not bheads:
1600 if not bheads:
1601 raise error.Abort(_('can only close branch heads'))
1601 raise error.Abort(_('can only close branch heads'))
1602 elif opts.get('amend'):
1602 elif opts.get('amend'):
1603 if repo.parents()[0].p1().branch() != branch and \
1603 if repo[None].parents()[0].p1().branch() != branch and \
1604 repo.parents()[0].p2().branch() != branch:
1604 repo[None].parents()[0].p2().branch() != branch:
1605 raise error.Abort(_('can only close branch heads'))
1605 raise error.Abort(_('can only close branch heads'))
1606
1606
1607 if opts.get('amend'):
1607 if opts.get('amend'):
@@ -4545,7 +4545,7 b' def import_(ui, repo, patch1=None, *patc'
4545 tr = repo.transaction('import')
4545 tr = repo.transaction('import')
4546 else:
4546 else:
4547 dsguard = cmdutil.dirstateguard(repo, 'import')
4547 dsguard = cmdutil.dirstateguard(repo, 'import')
4548 parents = repo.parents()
4548 parents = repo[None].parents()
4549 for patchurl in patches:
4549 for patchurl in patches:
4550 if patchurl == '-':
4550 if patchurl == '-':
4551 ui.status(_('applying patch from stdin\n'))
4551 ui.status(_('applying patch from stdin\n'))
@@ -4565,7 +4565,7 b' def import_(ui, repo, patch1=None, *patc'
4565 haspatch = True
4565 haspatch = True
4566 ui.note(msg + '\n')
4566 ui.note(msg + '\n')
4567 if update or opts.get('exact'):
4567 if update or opts.get('exact'):
4568 parents = repo.parents()
4568 parents = repo[None].parents()
4569 else:
4569 else:
4570 parents = [repo[node]]
4570 parents = [repo[node]]
4571 if rej:
4571 if rej:
@@ -852,10 +852,6 b' class localrepository(object):'
852 def changectx(self, changeid):
852 def changectx(self, changeid):
853 return self[changeid]
853 return self[changeid]
854
854
855 def parents(self, changeid=None):
856 '''get list of changectxs for parents of changeid'''
857 return self[changeid].parents()
858
859 def setparents(self, p1, p2=nullid):
855 def setparents(self, p1, p2=nullid):
860 self.dirstate.beginparentchange()
856 self.dirstate.beginparentchange()
861 copies = self.dirstate.setparents(p1, p2)
857 copies = self.dirstate.setparents(p1, p2)
@@ -1170,7 +1166,7 b' class localrepository(object):'
1170 % self.dirstate.branch())
1166 % self.dirstate.branch())
1171
1167
1172 self.dirstate.invalidate()
1168 self.dirstate.invalidate()
1173 parents = tuple([p.rev() for p in self.parents()])
1169 parents = tuple([p.rev() for p in self[None].parents()])
1174 if len(parents) > 1:
1170 if len(parents) > 1:
1175 ui.status(_('working directory now based on '
1171 ui.status(_('working directory now based on '
1176 'revisions %d and %d\n') % parents)
1172 'revisions %d and %d\n') % parents)
General Comments 0
You need to be logged in to leave comments. Login now