##// END OF EJS Templates
mq: check subrepo synchronizations against parent of workdir or other appropriate context...
FUJIWARA Katsunori -
r17153:54da604f default
parent child Browse files
Show More
@@ -933,16 +933,20 b' class queue(object):'
933 return top, patch
933 return top, patch
934 return None, None
934 return None, None
935
935
936 def checksubstate(self, repo):
936 def checksubstate(self, repo, baserev=None):
937 '''return list of subrepos at a different revision than substate.
937 '''return list of subrepos at a different revision than substate.
938 Abort if any subrepos have uncommitted changes.'''
938 Abort if any subrepos have uncommitted changes.'''
939 inclsubs = []
939 inclsubs = []
940 wctx = repo[None]
940 wctx = repo[None]
941 if baserev:
942 bctx = repo[baserev]
943 else:
944 bctx = wctx.parents()[0]
941 for s in wctx.substate:
945 for s in wctx.substate:
942 if wctx.sub(s).dirty(True):
946 if wctx.sub(s).dirty(True):
943 raise util.Abort(
947 raise util.Abort(
944 _("uncommitted changes in subrepository %s") % s)
948 _("uncommitted changes in subrepository %s") % s)
945 elif wctx.sub(s).dirty():
949 elif s not in bctx.substate or bctx.sub(s).dirty():
946 inclsubs.append(s)
950 inclsubs.append(s)
947 return inclsubs
951 return inclsubs
948
952
@@ -1488,13 +1492,14 b' class queue(object):'
1488 raise util.Abort(_("cannot refresh immutable revision"),
1492 raise util.Abort(_("cannot refresh immutable revision"),
1489 hint=_('see "hg help phases" for details'))
1493 hint=_('see "hg help phases" for details'))
1490
1494
1491 inclsubs = self.checksubstate(repo)
1495 cparents = repo.changelog.parents(top)
1496 patchparent = self.qparents(repo, top)
1497
1498 inclsubs = self.checksubstate(repo, hex(patchparent))
1492 if inclsubs:
1499 if inclsubs:
1493 inclsubs.append('.hgsubstate')
1500 inclsubs.append('.hgsubstate')
1494 substatestate = repo.dirstate['.hgsubstate']
1501 substatestate = repo.dirstate['.hgsubstate']
1495
1502
1496 cparents = repo.changelog.parents(top)
1497 patchparent = self.qparents(repo, top)
1498 ph = patchheader(self.join(patchfn), self.plainmode)
1503 ph = patchheader(self.join(patchfn), self.plainmode)
1499 diffopts = self.diffopts({'git': opts.get('git')}, patchfn)
1504 diffopts = self.diffopts({'git': opts.get('git')}, patchfn)
1500 if msg:
1505 if msg:
@@ -441,6 +441,74 b" both into 'revision' and 'patch file und"
441 -b6f6e9c41f3dfd374a6d2ed4535c87951cf979cf sub
441 -b6f6e9c41f3dfd374a6d2ed4535c87951cf979cf sub
442 +88ac1bef5ed43b689d1d200b59886b675dec474b sub
442 +88ac1bef5ed43b689d1d200b59886b675dec474b sub
443
443
444 $ hg qrefresh -u test -d '0 0'
445 $ cat .hgsubstate
446 88ac1bef5ed43b689d1d200b59886b675dec474b sub
447 $ hg diff -c tip
448 diff -r 44f846335325 -r b3e8c5fa3aaa .hgsubstate
449 --- a/.hgsubstate
450 +++ b/.hgsubstate
451 @@ -1,1 +1,1 @@
452 -b6f6e9c41f3dfd374a6d2ed4535c87951cf979cf sub
453 +88ac1bef5ed43b689d1d200b59886b675dec474b sub
454 $ cat .hg/patches/import-at-qrefresh
455 # HG changeset patch
456 # Date 0 0
457 # User test
458 # Parent 44f846335325209be6be35dc2c9a4be107278c09
459
460 diff -r 44f846335325 .hgsubstate
461 --- a/.hgsubstate
462 +++ b/.hgsubstate
463 @@ -1,1 +1,1 @@
464 -b6f6e9c41f3dfd374a6d2ed4535c87951cf979cf sub
465 +88ac1bef5ed43b689d1d200b59886b675dec474b sub
466
467 $ hg update -C tip
468 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
469 $ hg qpop -a
470 popping import-at-qrefresh
471 popping import-at-qnew
472 patch queue now empty
473
474 $ hg -R sub update -C 0
475 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
476 $ echo 'sub = sub' > .hgsub
477 $ hg commit -Am '#1 in parent'
478 adding .hgsub
479 $ hg -R sub update -C 1
480 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
481 $ hg commit -Am '#2 in parent (but be rollbacked soon)'
482 $ hg rollback
483 repository tip rolled back to revision 1 (undo commit)
484 working directory now based on revision 1
485 $ hg status
486 M .hgsubstate
487 $ hg qnew -u test -d '0 0' checkstate-at-qnew
488 $ hg -R sub parents --template '{node} sub\n'
489 88ac1bef5ed43b689d1d200b59886b675dec474b sub
490 $ cat .hgsubstate
491 88ac1bef5ed43b689d1d200b59886b675dec474b sub
492 $ hg diff -c tip
493 diff -r 4d91eb2fa1d1 -r 1259c112d884 .hgsubstate
494 --- a/.hgsubstate
495 +++ b/.hgsubstate
496 @@ -1,1 +1,1 @@
497 -b6f6e9c41f3dfd374a6d2ed4535c87951cf979cf sub
498 +88ac1bef5ed43b689d1d200b59886b675dec474b sub
499 $ cat .hg/patches/checkstate-at-qnew
500 # HG changeset patch
501 # Parent 4d91eb2fa1d1b22ec513347b9cd06f6b49d470fa
502 # User test
503 # Date 0 0
504
505 diff -r 4d91eb2fa1d1 -r 1259c112d884 .hgsubstate
506 --- a/.hgsubstate
507 +++ b/.hgsubstate
508 @@ -1,1 +1,1 @@
509 -b6f6e9c41f3dfd374a6d2ed4535c87951cf979cf sub
510 +88ac1bef5ed43b689d1d200b59886b675dec474b sub
511
444 $ cd ..
512 $ cd ..
445
513
446 $ cd ..
514 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now