##// END OF EJS Templates
dirstate: fix a potential traceback when in `copy` and `rename`...
marmoute -
r51225:9fc0d244 stable
parent child Browse files
Show More
@@ -2498,7 +2498,7 b' def copy(ui, repo, *pats, **opts):'
2498 """
2498 """
2499 opts = pycompat.byteskwargs(opts)
2499 opts = pycompat.byteskwargs(opts)
2500
2500
2501 context = repo.dirstate.changing_files
2501 context = lambda repo: repo.dirstate.changing_files(repo)
2502 rev = opts.get(b'at_rev')
2502 rev = opts.get(b'at_rev')
2503 ctx = None
2503 ctx = None
2504 if rev:
2504 if rev:
@@ -6012,7 +6012,7 b' def rename(ui, repo, *pats, **opts):'
6012 Returns 0 on success, 1 if errors are encountered.
6012 Returns 0 on success, 1 if errors are encountered.
6013 """
6013 """
6014 opts = pycompat.byteskwargs(opts)
6014 opts = pycompat.byteskwargs(opts)
6015 context = repo.dirstate.changing_files
6015 context = lambda repo: repo.dirstate.changing_files(repo)
6016 rev = opts.get(b'at_rev')
6016 rev = opts.get(b'at_rev')
6017 ctx = None
6017 ctx = None
6018 if rev:
6018 if rev:
@@ -200,6 +200,12 b' class dirstate:'
200 self._cwd
200 self._cwd
201
201
202 def refresh(self):
202 def refresh(self):
203 # XXX if this happens, you likely did not enter the `changing_xxx`
204 # using `repo.dirstate`, so a later `repo.dirstate` accesss might call
205 # `refresh`.
206 if self.is_changing_any:
207 msg = "refreshing the dirstate in the middle of a change"
208 raise error.ProgrammingError(msg)
203 if '_branch' in vars(self):
209 if '_branch' in vars(self):
204 del self._branch
210 del self._branch
205 if '_map' in vars(self) and self._map.may_need_refresh():
211 if '_map' in vars(self) and self._map.may_need_refresh():
@@ -2951,6 +2951,7 b' class localrepository:'
2951 known good state)."""
2951 known good state)."""
2952 unfi = self.unfiltered()
2952 unfi = self.unfiltered()
2953 if 'dirstate' in unfi.__dict__:
2953 if 'dirstate' in unfi.__dict__:
2954 assert not self.dirstate.is_changing_any
2954 del unfi.__dict__['dirstate']
2955 del unfi.__dict__['dirstate']
2955
2956
2956 def invalidate(self, clearfilecache=False):
2957 def invalidate(self, clearfilecache=False):
@@ -470,15 +470,16 b' blackbox should work if repo.ui.log is n'
470 > raise RuntimeError('raise')
470 > raise RuntimeError('raise')
471 > EOF
471 > EOF
472
472
473 $ cat >> $HGRCPATH << EOF
473
474 $ hg init $TESTTMP/blackbox-exception-only --config blackbox.track=commandexception
475 $ cat >> $TESTTMP/blackbox-exception-only/.hg/hgrc << EOF
474 > [blackbox]
476 > [blackbox]
475 > track = commandexception
477 > track = commandexception
476 > [extensions]
478 > [extensions]
477 > raise=$TESTTMP/raise.py
479 > raise=$TESTTMP/raise.py
478 > EOF
480 > EOF
481 $ cd $TESTTMP/blackbox-exception-only
479
482
480 $ hg init $TESTTMP/blackbox-exception-only
481 $ cd $TESTTMP/blackbox-exception-only
482
483
483 #if chg
484 #if chg
484 (chg exits 255 because it fails to receive an exit code)
485 (chg exits 255 because it fails to receive an exit code)
@@ -495,3 +496,25 b' blackbox should work if repo.ui.log is n'
495 $ tail -2 .hg/blackbox.log
496 $ tail -2 .hg/blackbox.log
496 RuntimeError: raise
497 RuntimeError: raise
497
498
499 $ cd ..
500
501 Check we did not broke `hg mv`
502 ------------------------------
503 (we did in 6.4rc)
504
505 basic setup
506
507 $ hg init blackbox-file-move
508 $ cd blackbox-file-move
509 $ echo foo > foo
510 $ hg add foo
511 $ hg commit -m 'foo'
512
513 copy a file
514
515 $ hg copy foo bar
516
517 move a file
518
519 $ hg mv foo goo
520
General Comments 0
You need to be logged in to leave comments. Login now