Show More
@@ -289,10 +289,10 b' def overridestatus(orig, ui, repo, *pats' | |||||
289 | finally: |
|
289 | finally: | |
290 | repo.lfstatus = False |
|
290 | repo.lfstatus = False | |
291 |
|
291 | |||
292 | def overridedirty(orig, repo, ignoreupdate=False): |
|
292 | def overridedirty(orig, repo, ignoreupdate=False, missing=False): | |
293 | try: |
|
293 | try: | |
294 | repo._repo.lfstatus = True |
|
294 | repo._repo.lfstatus = True | |
295 | return orig(repo, ignoreupdate) |
|
295 | return orig(repo, ignoreupdate=ignoreupdate, missing=missing) | |
296 | finally: |
|
296 | finally: | |
297 | repo._repo.lfstatus = False |
|
297 | repo._repo.lfstatus = False | |
298 |
|
298 |
@@ -1509,7 +1509,7 b' class workingctx(committablectx):' | |||||
1509 | "check whether a working directory is modified" |
|
1509 | "check whether a working directory is modified" | |
1510 | # check subrepos first |
|
1510 | # check subrepos first | |
1511 | for s in sorted(self.substate): |
|
1511 | for s in sorted(self.substate): | |
1512 | if self.sub(s).dirty(): |
|
1512 | if self.sub(s).dirty(missing=missing): | |
1513 | return True |
|
1513 | return True | |
1514 | # check current working dir |
|
1514 | # check current working dir | |
1515 | return ((merge and self.p2()) or |
|
1515 | return ((merge and self.p2()) or |
@@ -460,14 +460,15 b' class abstractsubrepo(object):' | |||||
460 | """ |
|
460 | """ | |
461 | return False |
|
461 | return False | |
462 |
|
462 | |||
463 | def dirty(self, ignoreupdate=False): |
|
463 | def dirty(self, ignoreupdate=False, missing=False): | |
464 | """returns true if the dirstate of the subrepo is dirty or does not |
|
464 | """returns true if the dirstate of the subrepo is dirty or does not | |
465 | match current stored state. If ignoreupdate is true, only check |
|
465 | match current stored state. If ignoreupdate is true, only check | |
466 | whether the subrepo has uncommitted changes in its dirstate. |
|
466 | whether the subrepo has uncommitted changes in its dirstate. If missing | |
|
467 | is true, check for deleted files. | |||
467 | """ |
|
468 | """ | |
468 | raise NotImplementedError |
|
469 | raise NotImplementedError | |
469 |
|
470 | |||
470 | def dirtyreason(self, ignoreupdate=False): |
|
471 | def dirtyreason(self, ignoreupdate=False, missing=False): | |
471 | """return reason string if it is ``dirty()`` |
|
472 | """return reason string if it is ``dirty()`` | |
472 |
|
473 | |||
473 | Returned string should have enough information for the message |
|
474 | Returned string should have enough information for the message | |
@@ -475,14 +476,15 b' class abstractsubrepo(object):' | |||||
475 |
|
476 | |||
476 | This returns None, otherwise. |
|
477 | This returns None, otherwise. | |
477 | """ |
|
478 | """ | |
478 | if self.dirty(ignoreupdate=ignoreupdate): |
|
479 | if self.dirty(ignoreupdate=ignoreupdate, missing=missing): | |
479 | return _("uncommitted changes in subrepository '%s'" |
|
480 | return _("uncommitted changes in subrepository '%s'" | |
480 | ) % subrelpath(self) |
|
481 | ) % subrelpath(self) | |
481 |
|
482 | |||
482 | def bailifchanged(self, ignoreupdate=False, hint=None): |
|
483 | def bailifchanged(self, ignoreupdate=False, hint=None): | |
483 | """raise Abort if subrepository is ``dirty()`` |
|
484 | """raise Abort if subrepository is ``dirty()`` | |
484 | """ |
|
485 | """ | |
485 |
dirtyreason = self.dirtyreason(ignoreupdate=ignoreupdate |
|
486 | dirtyreason = self.dirtyreason(ignoreupdate=ignoreupdate, | |
|
487 | missing=True) | |||
486 | if dirtyreason: |
|
488 | if dirtyreason: | |
487 | raise error.Abort(dirtyreason, hint=hint) |
|
489 | raise error.Abort(dirtyreason, hint=hint) | |
488 |
|
490 | |||
@@ -815,7 +817,7 b' class hgsubrepo(abstractsubrepo):' | |||||
815 | return total |
|
817 | return total | |
816 |
|
818 | |||
817 | @annotatesubrepoerror |
|
819 | @annotatesubrepoerror | |
818 | def dirty(self, ignoreupdate=False): |
|
820 | def dirty(self, ignoreupdate=False, missing=False): | |
819 | r = self._state[1] |
|
821 | r = self._state[1] | |
820 | if r == '' and not ignoreupdate: # no state recorded |
|
822 | if r == '' and not ignoreupdate: # no state recorded | |
821 | return True |
|
823 | return True | |
@@ -823,7 +825,7 b' class hgsubrepo(abstractsubrepo):' | |||||
823 | if r != w.p1().hex() and not ignoreupdate: |
|
825 | if r != w.p1().hex() and not ignoreupdate: | |
824 | # different version checked out |
|
826 | # different version checked out | |
825 | return True |
|
827 | return True | |
826 | return w.dirty() # working directory changed |
|
828 | return w.dirty(missing=missing) # working directory changed | |
827 |
|
829 | |||
828 | def basestate(self): |
|
830 | def basestate(self): | |
829 | return self._repo['.'].hex() |
|
831 | return self._repo['.'].hex() | |
@@ -1202,8 +1204,10 b' class svnsubrepo(abstractsubrepo):' | |||||
1202 | return True, True, bool(missing) |
|
1204 | return True, True, bool(missing) | |
1203 | return bool(changes), False, bool(missing) |
|
1205 | return bool(changes), False, bool(missing) | |
1204 |
|
1206 | |||
1205 | def dirty(self, ignoreupdate=False): |
|
1207 | def dirty(self, ignoreupdate=False, missing=False): | |
1206 |
|
|
1208 | wcchanged = self._wcchanged() | |
|
1209 | changed = wcchanged[0] or (missing and wcchanged[2]) | |||
|
1210 | if not changed: | |||
1207 | if self._state[1] in self._wcrevs() or ignoreupdate: |
|
1211 | if self._state[1] in self._wcrevs() or ignoreupdate: | |
1208 | return False |
|
1212 | return False | |
1209 | return True |
|
1213 | return True | |
@@ -1555,7 +1559,7 b' class gitsubrepo(abstractsubrepo):' | |||||
1555 | (revision, self._relpath)) |
|
1559 | (revision, self._relpath)) | |
1556 |
|
1560 | |||
1557 | @annotatesubrepoerror |
|
1561 | @annotatesubrepoerror | |
1558 | def dirty(self, ignoreupdate=False): |
|
1562 | def dirty(self, ignoreupdate=False, missing=False): | |
1559 | if self._gitmissing(): |
|
1563 | if self._gitmissing(): | |
1560 | return self._state[1] != '' |
|
1564 | return self._state[1] != '' | |
1561 | if self._gitisbare(): |
|
1565 | if self._gitisbare(): |
@@ -55,13 +55,13 b' Test that dirty is consistent through su' | |||||
55 |
|
55 | |||
56 | $ rm subrepo/b |
|
56 | $ rm subrepo/b | |
57 |
|
57 | |||
58 |
|
|
58 | A deleted subrepo file is flagged as dirty, like the top level repo | |
59 |
|
59 | |||
60 | $ hg id --config extensions.blackbox= --config blackbox.dirty=True |
|
60 | $ hg id --config extensions.blackbox= --config blackbox.dirty=True | |
61 | 9bfe45a197d7 tip |
|
61 | 9bfe45a197d7+ tip | |
62 | $ cat .hg/blackbox.log |
|
62 | $ cat .hg/blackbox.log | |
63 | * @9bfe45a197d7b0ab09bf287729dd57e9619c9da5 (*)> id (glob) |
|
63 | * @9bfe45a197d7b0ab09bf287729dd57e9619c9da5+ (*)> id (glob) | |
64 |
* @9bfe45a197d7b0ab09bf287729dd57e9619c9da5 (*)> id --config |
|
64 | * @9bfe45a197d7b0ab09bf287729dd57e9619c9da5+ (*)> id --config *extensions.blackbox=* --config *blackbox.dirty=True* exited 0 * (glob) | |
65 |
|
65 | |||
66 | TODO: a deleted file should be listed as such, like the top level repo |
|
66 | TODO: a deleted file should be listed as such, like the top level repo | |
67 |
|
67 | |||
@@ -99,10 +99,14 b' discrete unit, then this should probably' | |||||
99 | $ hg st -S |
|
99 | $ hg st -S | |
100 | ! subrepo/b |
|
100 | ! subrepo/b | |
101 |
|
101 | |||
102 |
|
|
102 | `hg update --check` notices a subrepo with a missing file, like it notices a | |
103 | a modified file. |
|
103 | missing file in the top level repo. | |
104 |
|
104 | |||
105 | $ hg up -r '.^' --check --config ui.interactive=True << EOF |
|
105 | $ hg up -r '.^' --check | |
|
106 | abort: uncommitted changes in subrepository 'subrepo' | |||
|
107 | [255] | |||
|
108 | ||||
|
109 | $ hg up -r '.^' --config ui.interactive=True << EOF | |||
106 | > c |
|
110 | > c | |
107 | > EOF |
|
111 | > EOF | |
108 | other [destination] changed b which local [working copy] deleted |
|
112 | other [destination] changed b which local [working copy] deleted | |
@@ -122,8 +126,5 b' a modified file.' | |||||
122 | Merge sees deleted subrepo files as an uncommitted change |
|
126 | Merge sees deleted subrepo files as an uncommitted change | |
123 |
|
127 | |||
124 | $ hg merge @other |
|
128 | $ hg merge @other | |
125 | subrepository subrepo diverged (local revision: de222c2e1eac, remote revision: 7d3f8eba8116) |
|
129 | abort: uncommitted changes in subrepository 'subrepo' | |
126 | (M)erge, keep (l)ocal [working copy] or keep (r)emote [merge rev]? m |
|
|||
127 | abort: uncommitted changes (in subrepo subrepo) |
|
|||
128 | (use 'hg status' to list changes) |
|
|||
129 |
|
|
130 | [255] |
@@ -249,13 +249,13 b' Check that deep archiving works' | |||||
249 | changessincelatesttag: 4 |
|
249 | changessincelatesttag: 4 | |
250 | $ hg update -Cq . |
|
250 | $ hg update -Cq . | |
251 |
|
251 | |||
252 | TODO: add the dirty flag for missing subrepo files |
|
252 | A deleted subrepo file is flagged as dirty, like the top level repo | |
253 |
|
253 | |||
254 | $ rm -r ../wdir sub1/sub2/folder/test.txt |
|
254 | $ rm -r ../wdir sub1/sub2/folder/test.txt | |
255 | $ hg archive -S -qr 'wdir()' ../wdir |
|
255 | $ hg archive -S -qr 'wdir()' ../wdir | |
256 | $ cat ../wdir/.hg_archival.txt |
|
256 | $ cat ../wdir/.hg_archival.txt | |
257 | repo: 7f491f53a367861f47ee64a80eb997d1f341b77a |
|
257 | repo: 7f491f53a367861f47ee64a80eb997d1f341b77a | |
258 | node: 9bb10eebee29dc0f1201dcf5977b811a540255fd |
|
258 | node: 9bb10eebee29dc0f1201dcf5977b811a540255fd+ | |
259 | branch: default |
|
259 | branch: default | |
260 | latesttag: null |
|
260 | latesttag: null | |
261 | latesttagdistance: 4 |
|
261 | latesttagdistance: 4 |
General Comments 0
You need to be logged in to leave comments.
Login now