848 """Solve trouble in your repository |
848 """Solve trouble in your repository |
849 |
849 |
850 - rebase unstable changeset to make it stable again, |
850 - rebase unstable changeset to make it stable again, |
851 - create proper diff from bumped changeset, |
851 - create proper diff from bumped changeset, |
852 - merge divergent changesets. |
852 - merge divergent changesets. |
|
853 - update to a successor if the working directory parent is |
|
854 obsolete |
853 |
855 |
854 By default, take the first trouble changeset that looks relevant. |
856 By default, take the first trouble changeset that looks relevant. |
855 |
857 |
856 (The logic is still a bit fuzzy) |
858 (The logic is still a bit fuzzy) |
857 |
859 |
879 graftcmd = commands.table['graft'][0] |
881 graftcmd = commands.table['graft'][0] |
880 return graftcmd(ui, repo, old_obsolete=True, **{'continue': True}) |
882 return graftcmd(ui, repo, old_obsolete=True, **{'continue': True}) |
881 |
883 |
882 tr = _picknexttroubled(ui, repo, anyopt or allopt) |
884 tr = _picknexttroubled(ui, repo, anyopt or allopt) |
883 if tr is None: |
885 if tr is None: |
|
886 if repo['.'].obsolete(): |
|
887 displayer = cmdutil.show_changeset(ui, repo, {'template': shorttemplate}) |
|
888 successors = set() |
|
889 |
|
890 for successorsset in obsolete.successorssets(repo, repo['.'].node()): |
|
891 for nodeid in successorsset: |
|
892 successors.add(repo[nodeid]) |
|
893 |
|
894 if not successors: |
|
895 ui.warn(_('parent is obsolete without successors; ' + |
|
896 'likely killed\n')) |
|
897 return 2 |
|
898 |
|
899 elif len(successors) > 1: |
|
900 ui.warn(_('parent is obsolete with multiple successors:\n')) |
|
901 |
|
902 for ctx in sorted(successors, key=lambda ctx: ctx.rev()): |
|
903 displayer.show(ctx) |
|
904 |
|
905 return 2 |
|
906 |
|
907 else: |
|
908 ctx = successors.pop() |
|
909 |
|
910 ui.status(_('update:')) |
|
911 if not ui.quiet: |
|
912 displayer.show(ctx) |
|
913 |
|
914 if dryrunopt: |
|
915 print 'hg update %s' % ctx.rev() |
|
916 return 0 |
|
917 else: |
|
918 return hg.update(repo, ctx.rev()) |
|
919 |
884 troubled = repo.revs('troubled()') |
920 troubled = repo.revs('troubled()') |
885 if troubled: |
921 if troubled: |
886 ui.write_err(_('nothing to evolve here\n')) |
922 ui.write_err(_('nothing to evolve here\n')) |
887 ui.status(_('(%i troubled changesets, do you want --any ?)\n') |
923 ui.status(_('(%i troubled changesets, do you want --any ?)\n') |
888 % len(troubled)) |
924 % len(troubled)) |