Patchwork [10,of,15,v2] shelve: access status fields by name rather than index

login
register
mail settings
Submitter Martin von Zweigbergk
Date Oct. 5, 2014, 6:08 a.m.
Message ID <6796f8b96a634a81db94.1412489287@handduk2.mtv.corp.google.com>
Download mbox | patch
Permalink /patch/6135/
State Superseded
Commit ebef5fcf7bd0d5306af18e281b02d9c7d61d49e4
Headers show

Comments

Martin von Zweigbergk - Oct. 5, 2014, 6:08 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 6796f8b96a634a81db9417bd59080e719d77b515
# Parent  d23f2da75446b3869ad4e275fc47ebc7810f5baf
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)
@@ -545,8 +545,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):