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

login
register
mail settings
Submitter Martin von Zweigbergk
Date Oct. 10, 2014, 10:20 p.m.
Message ID <69dd78fa919be64e8778.1412979643@handduk2.mtv.corp.google.com>
Download mbox | patch
Permalink /patch/6201/
State Superseded
Headers show

Comments

Martin von Zweigbergk - Oct. 10, 2014, 10:20 p.m.
# HG changeset patch
# User Martin von Zweigbergk <martinvonz@gmail.com>
# Date 1412399563 25200
#      Fri Oct 03 22:12:43 2014 -0700
# Node ID 69dd78fa919be64e877872a6c5d388827b29f3d4
# Parent  94982fdcee6eff5a43a9d25c702102f52080bdf6
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):