Commits

TakUnity committed 90f0a1e

evolve: clean up evolve implementation.

Comments (0)

Files changed (1)

     allopt = opts['all']
     dryrunopt = opts['dry_run']
 
-    evolved_changesets = 0
-
     if contopt:
         if anyopt:
             raise util.Abort('can not specify both "--any" and "--continue"')
             raise util.Abort('can not specify both "--all" and "--continue"')
         graftcmd = commands.table['graft'][0]
         return graftcmd(ui, repo, old_obsolete=True, **{'continue': True})
-    while True:
-        result = _evolveany(ui, repo, anyopt or allopt, dryrunopt)
-        if(1 == result):
-            if(0 < evolved_changesets):
-                # We evolved some changesets, and now we're done
-                return 0
-            ui.write_err(_('no troubled changeset\n')) 
-        if not allopt:
-            return result
-        evolved_changesets+=1
-        
 
-def _evolveany(ui, repo, anyopt, dryrunopt):
-    tr = _picknexttroubled(ui, repo, anyopt)
+    tr = _picknexttroubled(ui, repo, anyopt or allopt)
     if tr is None:
         troubled = repo.revs('troubled()')
         if troubled:
                       % len(troubled))
             return 2
         else:
+            ui.write_err(_('no troubled changeset\n')) 
             return 1
+
+    while tr is not None:
+        result = _evolveany(ui, repo, tr, dryrunopt)
+        if 2 == result or not allopt:
+            return result
+        tr = _picknexttroubled(ui, repo, anyopt or allopt)
+        
+
+def _evolveany(ui, repo, tr, dryrunopt):
     repo = repo.unfiltered()
     tr = repo[tr.rev()]
     cmdutil.bailifchanged(repo)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.