comparison hgext/evolve.py @ 1239:8a06b32061ce

evolve: apply prune update before creating obsolescence markers Prune used to compute the destination commit to update to after creating the obsolescence markers. This is a commit to prevent a bug that would occur with the changes in inhibit for transactions (next commit). Indeed, with that change in inhibit, when creating the obsolescence markers in prune, they would get inhibited right away and we wouldn't update to the first non obsolete parent but stay on the same node as its obsolescence would have been inhibited (bug).
author Laurent Charignon <lcharignon@fb.com>
date Thu, 02 Apr 2015 18:33:44 -0700
parents ffa32ca659f1
children 4279ec5ff3a7
comparison
equal deleted inserted replaced
1238:ee695c7d1bf1 1239:8a06b32061ce
1830 1830
1831 relations = [(p, sucs) for p in precs] 1831 relations = [(p, sucs) for p in precs]
1832 if biject: 1832 if biject:
1833 relations = [(p, (s,)) for p, s in zip(precs, sucs)] 1833 relations = [(p, (s,)) for p, s in zip(precs, sucs)]
1834 1834
1835 # create markers
1836 obsolete.createmarkers(repo, relations, metadata=metadata)
1837
1838 # informs that changeset have been pruned
1839 ui.status(_('%i changesets pruned\n') % len(precs))
1840
1841 wdp = repo['.'] 1835 wdp = repo['.']
1842 1836
1843 if len(sucs) == 1 and len(precs) == 1 and wdp in precs: 1837 if len(sucs) == 1 and len(precs) == 1 and wdp in precs:
1844 # '.' killed, so update to the successor 1838 # '.' killed, so update to the successor
1845 newnode = sucs[0] 1839 newnode = sucs[0]
1846 else: 1840 else:
1847 # update to an unkilled parent 1841 # update to an unkilled parent
1848 newnode = wdp 1842 newnode = wdp
1849 1843
1850 while newnode.obsolete(): 1844 while newnode in precs or newnode.obsolete():
1851 newnode = newnode.parents()[0] 1845 newnode = newnode.parents()[0]
1846
1852 1847
1853 if newnode.node() != wdp.node(): 1848 if newnode.node() != wdp.node():
1854 if opts.get('keep', False): 1849 if opts.get('keep', False):
1855 # This is largely the same as the implementation in 1850 # This is largely the same as the implementation in
1856 # strip.stripcmd(). We might want to refactor this somewhere 1851 # strip.stripcmd(). We might want to refactor this somewhere
1874 commands.update(ui, repo, newnode.rev()) 1869 commands.update(ui, repo, newnode.rev())
1875 ui.status(_('working directory now at %s\n') % newnode) 1870 ui.status(_('working directory now at %s\n') % newnode)
1876 # update bookmarks 1871 # update bookmarks
1877 if bookmark: 1872 if bookmark:
1878 _deletebookmark(ui, marks, bookmark) 1873 _deletebookmark(ui, marks, bookmark)
1874
1875 # create markers
1876 obsolete.createmarkers(repo, relations, metadata=metadata)
1877
1878 # informs that changeset have been pruned
1879 ui.status(_('%i changesets pruned\n') % len(precs))
1880
1879 for ctx in repo.unfiltered().set('bookmark() and %ld', precs): 1881 for ctx in repo.unfiltered().set('bookmark() and %ld', precs):
1880 # used to be: 1882 # used to be:
1881 # 1883 #
1882 # ldest = list(repo.set('max((::%d) - obsolete())', ctx)) 1884 # ldest = list(repo.set('max((::%d) - obsolete())', ctx))
1883 # if ldest: 1885 # if ldest: