2059 repo._bookmarks[book] = new.node() |
2059 repo._bookmarks[book] = new.node() |
2060 if oldbookmarks: |
2060 if oldbookmarks: |
2061 repo._bookmarks.write() |
2061 repo._bookmarks.write() |
2062 return result |
2062 return result |
2063 finally: |
2063 finally: |
2064 if lock is not None: |
2064 lockmod.release(lock, wlock) |
2065 lock.release() |
|
2066 if wlock is not None: |
|
2067 wlock.release() |
|
2068 |
2065 |
2069 @command('^touch', |
2066 @command('^touch', |
2070 [('r', 'rev', [], 'revision to update'), |
2067 [('r', 'rev', [], 'revision to update'), |
2071 ('D', 'duplicate', False, |
2068 ('D', 'duplicate', False, |
2072 'do not mark the new revision as successor of the old one')], |
2069 'do not mark the new revision as successor of the old one')], |
2086 if not revs: |
2083 if not revs: |
2087 ui.write_err('no revision to touch\n') |
2084 ui.write_err('no revision to touch\n') |
2088 return 1 |
2085 return 1 |
2089 if not duplicate and repo.revs('public() and %ld', revs): |
2086 if not duplicate and repo.revs('public() and %ld', revs): |
2090 raise util.Abort("can't touch public revision") |
2087 raise util.Abort("can't touch public revision") |
2091 wlock = lock = None |
2088 wlock = lock = tr = None |
2092 try: |
2089 try: |
2093 wlock = repo.wlock() |
2090 wlock = repo.wlock() |
2094 lock = repo.lock() |
2091 lock = repo.lock() |
2095 tr = repo.transaction('touch') |
2092 tr = repo.transaction('touch') |
2096 revs.sort() # ensure parent are run first |
2093 revs.sort() # ensure parent are run first |
2097 newmapping = {} |
2094 newmapping = {} |
2098 try: |
2095 for r in revs: |
2099 for r in revs: |
2096 ctx = repo[r] |
2100 ctx = repo[r] |
2097 extra = ctx.extra().copy() |
2101 extra = ctx.extra().copy() |
2098 extra['__touch-noise__'] = random.randint(0, 0xffffffff) |
2102 extra['__touch-noise__'] = random.randint(0, 0xffffffff) |
2099 # search for touched parent |
2103 # search for touched parent |
2100 p1 = ctx.p1().node() |
2104 p1 = ctx.p1().node() |
2101 p2 = ctx.p2().node() |
2105 p2 = ctx.p2().node() |
2102 p1 = newmapping.get(p1, p1) |
2106 p1 = newmapping.get(p1, p1) |
2103 p2 = newmapping.get(p2, p2) |
2107 p2 = newmapping.get(p2, p2) |
2104 new, unusedvariable = rewrite(repo, ctx, [], ctx, |
2108 new, unusedvariable = rewrite(repo, ctx, [], ctx, |
2105 [p1, p2], |
2109 [p1, p2], |
2106 commitopts={'extra': extra}) |
2110 commitopts={'extra': extra}) |
2107 # store touched version to help potential children |
2111 # store touched version to help potential children |
2108 newmapping[ctx.node()] = new |
2112 newmapping[ctx.node()] = new |
2109 if not duplicate: |
2113 if not duplicate: |
2110 obsolete.createmarkers(repo, [(ctx, (repo[new],))]) |
2114 obsolete.createmarkers(repo, [(ctx, (repo[new],))]) |
2111 phases.retractboundary(repo, tr, ctx.phase(), [new]) |
2115 phases.retractboundary(repo, tr, ctx.phase(), [new]) |
2112 if ctx in repo[None].parents(): |
2116 if ctx in repo[None].parents(): |
2113 repo.dirstate.beginparentchange() |
2117 repo.dirstate.beginparentchange() |
2114 repo.dirstate.setparents(new, node.nullid) |
2118 repo.dirstate.setparents(new, node.nullid) |
2115 repo.dirstate.endparentchange() |
2119 repo.dirstate.endparentchange() |
2116 tr.close() |
2120 tr.close() |
|
2121 finally: |
|
2122 tr.release() |
|
2123 finally: |
2117 finally: |
2124 lockmod.release(lock, wlock) |
2118 lockmod.release(tr, lock, wlock) |
2125 |
2119 |
2126 @command('^fold|squash', |
2120 @command('^fold|squash', |
2127 [('r', 'rev', [], _("revision to fold")), |
2121 [('r', 'rev', [], _("revision to fold")), |
2128 ('', 'exact', None, _("only fold specified revisions")) |
2122 ('', 'exact', None, _("only fold specified revisions")) |
2129 ] + commitopts + commitopts2, |
2123 ] + commitopts + commitopts2, |
2572 return caps |
2566 return caps |
2573 |
2567 |
2574 @eh.addattr(localrepo.localpeer, 'evoext_pushobsmarkers_0') |
2568 @eh.addattr(localrepo.localpeer, 'evoext_pushobsmarkers_0') |
2575 def local_pushobsmarkers(peer, obsfile): |
2569 def local_pushobsmarkers(peer, obsfile): |
2576 data = obsfile.read() |
2570 data = obsfile.read() |
2577 lock = peer._repo.lock() |
2571 tr = lock = None |
2578 try: |
2572 try: |
|
2573 lock = peer._repo.lock() |
2579 tr = peer._repo.transaction('pushkey: obsolete markers') |
2574 tr = peer._repo.transaction('pushkey: obsolete markers') |
2580 try: |
2575 new = peer._repo.obsstore.mergemarkers(tr, data) |
2581 new = peer._repo.obsstore.mergemarkers(tr, data) |
2576 if new is not None: |
2582 if new is not None: |
2577 obsexcmsg(peer._repo.ui, "%i obsolescence markers added\n" % new, True) |
2583 obsexcmsg(peer._repo.ui, "%i obsolescence markers added\n" % new, True) |
2578 tr.close() |
2584 tr.close() |
|
2585 finally: |
|
2586 tr.release() |
|
2587 finally: |
2579 finally: |
2588 lock.release() |
2580 lockmod.release(tr, lock) |
2589 peer._repo.hook('evolve_pushobsmarkers') |
2581 peer._repo.hook('evolve_pushobsmarkers') |
2590 |
2582 |
2591 def srv_pushobsmarkers(repo, proto): |
2583 def srv_pushobsmarkers(repo, proto): |
2592 """wireprotocol command""" |
2584 """wireprotocol command""" |
2593 fp = StringIO() |
2585 fp = StringIO() |
2594 proto.redirect() |
2586 proto.redirect() |
2595 proto.getfile(fp) |
2587 proto.getfile(fp) |
2596 data = fp.getvalue() |
2588 data = fp.getvalue() |
2597 fp.close() |
2589 fp.close() |
2598 lock = repo.lock() |
2590 tr = lock = None |
2599 try: |
2591 try: |
|
2592 lock = repo.lock() |
2600 tr = repo.transaction('pushkey: obsolete markers') |
2593 tr = repo.transaction('pushkey: obsolete markers') |
2601 try: |
2594 new = repo.obsstore.mergemarkers(tr, data) |
2602 new = repo.obsstore.mergemarkers(tr, data) |
2595 if new is not None: |
2603 if new is not None: |
2596 obsexcmsg(repo.ui, "%i obsolescence markers added\n" % new, True) |
2604 obsexcmsg(repo.ui, "%i obsolescence markers added\n" % new, True) |
2597 tr.close() |
2605 tr.close() |
|
2606 finally: |
|
2607 tr.release() |
|
2608 finally: |
2598 finally: |
2609 lock.release() |
2599 lockmod.release(tr, lock) |
2610 repo.hook('evolve_pushobsmarkers') |
2600 repo.hook('evolve_pushobsmarkers') |
2611 return wireproto.pushres(0) |
2601 return wireproto.pushres(0) |
2612 |
2602 |
2613 def _buildpullobsmarkersboundaries(pullop): |
2603 def _buildpullobsmarkersboundaries(pullop): |
2614 """small funtion returning the argument for pull markers call |
2604 """small funtion returning the argument for pull markers call |