##// END OF EJS Templates
mq: do not allow to push from repo with patches applied
Vadim Gelfer -
r2848:307439d6 default
parent child Browse files
Show More
@@ -1832,18 +1832,28 b' def select(ui, repo, *args, **opts):'
1832
1832
1833 def reposetup(ui, repo):
1833 def reposetup(ui, repo):
1834 class mqrepo(repo.__class__):
1834 class mqrepo(repo.__class__):
1835 def abort_if_wdir_patched(self, errmsg, force=False):
1836 if self.mq.applied and not force:
1837 parent = revlog.hex(self.dirstate.parents()[0])
1838 if parent in [s.rev for s in self.mq.applied]:
1839 raise util.Abort(errmsg)
1840
1835 def commit(self, *args, **opts):
1841 def commit(self, *args, **opts):
1836 if len(args) >= 6:
1842 if len(args) >= 6:
1837 force = args[5]
1843 force = args[5]
1838 else:
1844 else:
1839 force = opts.get('force')
1845 force = opts.get('force')
1840 if self.mq.applied and not force:
1846 self.abort_if_wdir_patched(
1841 parent = revlog.hex(self.dirstate.parents()[0])
1847 _('cannot commit over an applied mq patch'),
1842 if parent in [s.rev for s in self.mq.applied]:
1848 force)
1843 raise util.Abort(_('cannot commit over an applied mq patch'))
1844
1849
1845 return super(mqrepo, self).commit(*args, **opts)
1850 return super(mqrepo, self).commit(*args, **opts)
1846
1851
1852 def push(self, remote, force=False, revs=None):
1853 if self.mq.applied and not force:
1854 raise util.Abort(_('source has mq patches applied'))
1855 return super(mqrepo, self).push(remote, force, revs)
1856
1847 def tags(self):
1857 def tags(self):
1848 if self.tagscache:
1858 if self.tagscache:
1849 return self.tagscache
1859 return self.tagscache
@@ -10,6 +10,10 b' hg help mq'
10 hg init a
10 hg init a
11 cd a
11 cd a
12 echo a > a
12 echo a > a
13 hg ci -Ama
14
15 hg clone . ../k
16
13 mkdir b
17 mkdir b
14 echo z > b/z
18 echo z > b/z
15 hg ci -Ama
19 hg ci -Ama
@@ -106,9 +110,16 b' hg qapplied'
106 echo % commit should fail
110 echo % commit should fail
107 hg commit
111 hg commit
108
112
113 echo % push should fail
114 hg push ../../k
115
109 echo % qunapplied
116 echo % qunapplied
110 hg qunapplied
117 hg qunapplied
111
118
119 echo % push should succeed
120 hg qpop -a
121 hg push ../../k
122
112 echo % strip
123 echo % strip
113 cd ../../b
124 cd ../../b
114 echo x>x
125 echo x>x
@@ -49,6 +49,7 b' list of commands (use "hg help -v mq" to'
49 qunapplied print the patches not yet applied
49 qunapplied print the patches not yet applied
50 strip strip a revision and all later revs on the same branch
50 strip strip a revision and all later revs on the same branch
51 adding a
51 adding a
52 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
52 adding b/z
53 adding b/z
53 % qinit
54 % qinit
54 % -R qinit
55 % -R qinit
@@ -104,6 +105,9 b' Only one patch applied'
104 test.patch
105 test.patch
105 % commit should fail
106 % commit should fail
106 abort: cannot commit over an applied mq patch
107 abort: cannot commit over an applied mq patch
108 % push should fail
109 pushing to ../../k
110 abort: source has mq patches applied
107 % qunapplied
111 % qunapplied
108 test2.patch
112 test2.patch
109 % strip
113 % strip
General Comments 0
You need to be logged in to leave comments. Login now