##// END OF EJS Templates
push: move `force` argument into the push object...
Pierre-Yves David -
r20349:89f90457 default
parent child Browse files
Show More
@@ -21,12 +21,14 b' class pushoperation(object):'
21 21 afterward.
22 22 """
23 23
24 def __init__(self, repo, remote):
24 def __init__(self, repo, remote, force=False):
25 25 # repo we push from
26 26 self.repo = repo
27 27 self.ui = repo.ui
28 28 # repo we push to
29 29 self.remote = remote
30 # force option provided
31 self.force = force
30 32
31 33 def push(repo, remote, force=False, revs=None, newbranch=False):
32 34 '''Push outgoing changesets (limited by revs) from a local
@@ -37,7 +39,7 b' def push(repo, remote, force=False, revs'
37 39 we have outgoing changesets but refused to push
38 40 - other values as described by addchangegroup()
39 41 '''
40 pushop = pushoperation(repo, remote)
42 pushop = pushoperation(repo, remote, force)
41 43 if pushop.remote.local():
42 44 missing = (set(pushop.repo.requirements)
43 45 - pushop.remote.local().supported)
@@ -84,7 +86,7 b' def push(repo, remote, force=False, revs'
84 86 msg = 'cannot lock source repository: %s\n' % err
85 87 pushop.ui.debug(msg)
86 88 try:
87 pushop.repo.checkpush(force, revs)
89 pushop.repo.checkpush(pushop.force, revs)
88 90 lock = None
89 91 unbundle = pushop.remote.capable('unbundle')
90 92 if not unbundle:
@@ -92,11 +94,11 b' def push(repo, remote, force=False, revs'
92 94 try:
93 95 # discovery
94 96 fci = discovery.findcommonincoming
95 commoninc = fci(unfi, pushop.remote, force=force)
97 commoninc = fci(unfi, pushop.remote, force=pushop.force)
96 98 common, inc, remoteheads = commoninc
97 99 fco = discovery.findcommonoutgoing
98 100 outgoing = fco(unfi, pushop.remote, onlyheads=revs,
99 commoninc=commoninc, force=force)
101 commoninc=commoninc, force=pushop.force)
100 102
101 103
102 104 if not outgoing.missing:
@@ -105,7 +107,7 b' def push(repo, remote, force=False, revs'
105 107 ret = None
106 108 else:
107 109 # something to push
108 if not force:
110 if not pushop.force:
109 111 # if repo.obsstore == False --> no obsolete
110 112 # then, save the iteration
111 113 if unfi.obsstore:
@@ -155,7 +157,7 b' def push(repo, remote, force=False, revs'
155 157 # revs it must push. once revs transferred, if server
156 158 # finds it has different heads (someone else won
157 159 # commit/push race), server aborts.
158 if force:
160 if pushop.force:
159 161 remoteheads = ['force']
160 162 # ssh: return remote's addchangegroup()
161 163 # http: return remote's addchangegroup() or 0 for error
General Comments 0
You need to be logged in to leave comments. Login now