Patchwork [11,of,17,V4] shelve: access status fields by name rather than index

login
register
mail settings
Submitter Martin von Zweigbergk
Date Oct. 12, 2014, 5:44 a.m.
Message ID <4ced5d6b3923d2f12d8c.1413092668@handduk2.mtv.corp.google.com>
Download mbox | patch
Permalink /patch/6227/
State Accepted
Headers show

Comments

Martin von Zweigbergk - Oct. 12, 2014, 5:44 a.m.
# HG changeset patch
# User Martin von Zweigbergk <martinvonz@gmail.com>
# Date 1412399563 25200
#      Fri Oct 03 22:12:43 2014 -0700
# Node ID 4ced5d6b3923d2f12d8c2c88c9b9c126bd854dfd
# Parent  3ba27b307317eb4309c81d207bebb3d63a685483
shelve: access status fields by name rather than index

Patch

diff --git a/hgext/shelve.py b/hgext/shelve.py
--- a/hgext/shelve.py
+++ b/hgext/shelve.py
@@ -227,9 +227,9 @@ 
 
         if not node:
             stat = repo.status(match=scmutil.match(repo[None], pats, opts))
-            if stat[3]:
+            if stat.deleted:
                 ui.status(_("nothing changed (%d missing files, see "
-                            "'hg status')\n") % len(stat[3]))
+                            "'hg status')\n") % len(stat.deleted))
             else:
                 ui.status(_("nothing changed\n"))
             return 1
@@ -401,7 +401,7 @@ 
         files.extend(shelvectx.parents()[0].files())
 
         # revert will overwrite unknown files, so move them out of the way
-        for file in repo.status(unknown=True)[4]:
+        for file in repo.status(unknown=True).unknown:
             if file in files:
                 util.rename(file, file + ".orig")
         ui.pushbuffer(True)
@@ -547,8 +547,8 @@ 
         # to the original pctx.
 
         # Store pending changes in a commit
-        m, a, r, d = repo.status()[:4]
-        if m or a or r or d:
+        s = repo.status()
+        if s.modified or s.added or s.removed or s.deleted:
             ui.status(_("temporarily committing pending changes "
                         "(restore with 'hg unshelve --abort')\n"))
             def commitfunc(ui, repo, message, match, opts):