##// END OF EJS Templates
mq: always require --force when pushing patches (issue2363)...
Patrick Mezard -
r12378:ab237534 stable
parent child Browse files
Show More
@@ -2713,8 +2713,16 b' def reposetup(ui, repo):'
2713 editor, extra)
2713 editor, extra)
2714
2714
2715 def push(self, remote, force=False, revs=None, newbranch=False):
2715 def push(self, remote, force=False, revs=None, newbranch=False):
2716 if self.mq.applied and not force and not revs:
2716 if self.mq.applied and not force:
2717 raise util.Abort(_('source has mq patches applied'))
2717 haspatches = True
2718 if revs:
2719 # Assume applied patches have no non-patch descendants
2720 # and are not on remote already. If they appear in the
2721 # set of resolved 'revs', bail out.
2722 applied = set(e.node for e in self.mq.applied)
2723 haspatches = bool([n for n in revs if n in applied])
2724 if haspatches:
2725 raise util.Abort(_('source has mq patches applied'))
2718 return super(mqrepo, self).push(remote, force, revs, newbranch)
2726 return super(mqrepo, self).push(remote, force, revs, newbranch)
2719
2727
2720 def _findtags(self):
2728 def _findtags(self):
@@ -62,3 +62,29 b' hg ci -mmerge'
62 hg up default
62 hg up default
63 hg log
63 hg log
64 hg qpush
64 hg qpush
65 cd ..
66
67 echo '% testing applied patches, push and --force'
68 hg init forcepush
69 cd forcepush
70 echo a > a
71 hg ci -Am adda
72 echo a >> a
73 hg ci -m changea
74 hg up 0
75 hg branch branch
76 echo b > b
77 hg ci -Am addb
78 hg up 0
79 hg --cwd .. clone -r 0 forcepush forcepush2
80 echo a >> a
81 hg qnew patch
82 echo '% pushing applied patch with --rev without --force'
83 hg push -r default ../forcepush2
84 echo '% pushing applied patch with branchhash, without --force'
85 hg push ../forcepush2#default
86 echo '% pushing revs excluding applied patch'
87 hg push --new-branch -r branch -r 2 ../forcepush2
88 echo '% pushing applied patch with --force'
89 hg push --force -r default ../forcepush2
90 cd ..
@@ -45,3 +45,36 b' summary: a'
45
45
46 applying qp
46 applying qp
47 now at: qp
47 now at: qp
48 % testing applied patches, push and --force
49 adding a
50 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
51 marked working directory as branch branch
52 adding b
53 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
54 requesting all changes
55 adding changesets
56 adding manifests
57 adding file changes
58 added 1 changesets with 1 changes to 1 files
59 updating to branch default
60 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
61 % pushing applied patch with --rev without --force
62 pushing to ../forcepush2
63 abort: source has mq patches applied
64 % pushing applied patch with branchhash, without --force
65 pushing to ../forcepush2
66 abort: source has mq patches applied
67 % pushing revs excluding applied patch
68 pushing to ../forcepush2
69 searching for changes
70 adding changesets
71 adding manifests
72 adding file changes
73 added 1 changesets with 1 changes to 1 files
74 % pushing applied patch with --force
75 pushing to ../forcepush2
76 searching for changes
77 adding changesets
78 adding manifests
79 adding file changes
80 added 1 changesets with 1 changes to 1 files (+1 heads)
General Comments 0
You need to be logged in to leave comments. Login now