Mercurial > hgsubversion
comparison hgsubversion/wrappers.py @ 626:8e621dbb82d4 1.1.1
push: return reasonable status codes to the end user
| author | Augie Fackler <durin42@gmail.com> |
|---|---|
| date | Sun, 27 Jun 2010 21:18:47 -0500 |
| parents | 8acae2416ec1 |
| children | 3ff8666b1479 |
comparison
equal
deleted
inserted
replaced
| 625:96552e855d7e | 626:8e621dbb82d4 |
|---|---|
| 127 | 127 |
| 128 # Strategy: | 128 # Strategy: |
| 129 # 1. Find all outgoing commits from this head | 129 # 1. Find all outgoing commits from this head |
| 130 if len(repo.parents()) != 1: | 130 if len(repo.parents()) != 1: |
| 131 ui.status('Cowardly refusing to push branch merge\n') | 131 ui.status('Cowardly refusing to push branch merge\n') |
| 132 return 1 | 132 return 0 # results in nonzero exit status, see hg's commands.py |
| 133 workingrev = repo.parents()[0] | 133 workingrev = repo.parents()[0] |
| 134 ui.status('searching for changes\n') | 134 ui.status('searching for changes\n') |
| 135 hashes = meta.revmap.hashes() | 135 hashes = meta.revmap.hashes() |
| 136 outgoing = util.outgoing_revisions(repo, hashes, workingrev.node()) | 136 outgoing = util.outgoing_revisions(repo, hashes, workingrev.node()) |
| 137 if not (outgoing and len(outgoing)): | 137 if not (outgoing and len(outgoing)): |
| 138 ui.status('no changes found\n') | 138 ui.status('no changes found\n') |
| 139 return 0 | 139 return 1 # so we get a sane exit status, see hg's commands.push |
| 140 while outgoing: | 140 while outgoing: |
| 141 oldest = outgoing.pop(-1) | 141 oldest = outgoing.pop(-1) |
| 142 old_ctx = repo[oldest] | 142 old_ctx = repo[oldest] |
| 143 if len(old_ctx.parents()) != 1: | 143 if len(old_ctx.parents()) != 1: |
| 144 ui.status('Found a branch merge, this needs discussion and ' | 144 ui.status('Found a branch merge, this needs discussion and ' |
| 145 'implementation.\n') | 145 'implementation.\n') |
| 146 return 1 | 146 return 0 # results in nonzero exit status, see hg's commands.py |
| 147 base_n = old_ctx.parents()[0].node() | 147 base_n = old_ctx.parents()[0].node() |
| 148 old_children = repo[base_n].children() | 148 old_children = repo[base_n].children() |
| 149 svnbranch = repo[base_n].branch() | 149 svnbranch = repo[base_n].branch() |
| 150 oldtip = base_n | 150 oldtip = base_n |
| 151 samebranchchildren = [c for c in repo[oldtip].children() if c.branch() == svnbranch | 151 samebranchchildren = [c for c in repo[oldtip].children() if c.branch() == svnbranch |
| 196 rebasesrc = node.bin(child.extra().get('rebase_source', node.hex(node.nullid))) | 196 rebasesrc = node.bin(child.extra().get('rebase_source', node.hex(node.nullid))) |
| 197 # TODO: stop constantly creating the SVNMeta instances. | 197 # TODO: stop constantly creating the SVNMeta instances. |
| 198 meta = repo.svnmeta(svn.uuid) | 198 meta = repo.svnmeta(svn.uuid) |
| 199 hashes = meta.revmap.hashes() | 199 hashes = meta.revmap.hashes() |
| 200 util.swap_out_encoding(old_encoding) | 200 util.swap_out_encoding(old_encoding) |
| 201 return 0 | 201 return 1 # so we get a sane exit status, see hg's commands.push |
| 202 | 202 |
| 203 | 203 |
| 204 def pull(repo, source, heads=[], force=False): | 204 def pull(repo, source, heads=[], force=False): |
| 205 """pull new revisions from Subversion""" | 205 """pull new revisions from Subversion""" |
| 206 assert source.capable('subversion') | 206 assert source.capable('subversion') |
