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