Commits

rcohen committed 945c4dc

Fix for losing changes when specific files are listed for shelving.

  • Participants
  • Parent commits 4f10732

Comments (0)

Files changed (1)

         self.currentpatch=name
         self.persiststate()
 
-    def cleanup(self, repo):
+    def cleanup(self, repo, pats=[], opts={}):
         '''removes all changes from the working copy and makes it so
         there isn't a patch applied'''
         node = repo.dirstate.parents()[0]
-        hg.clean(repo, node, False)
+        if not pats and not opts.get('include') and not opts.get('exclude'):
+            hg.clean(repo, node, False)
+        else:
+            opts['date'] = None
+            opts['all'] = True # Just to trick revert
+            opts['rev'] = node
+            commands.revert(self.ui, repo, *pats, **opts)
         self.applied = ''
         self.persiststate()
 
                 s.persiststate()
             ui.status(_('patch %s refreshed\n') % (s.applied))
         else:
-            s.cleanup(repo)
+            s.cleanup(repo, pats=pats, opts=opts)
             ui.status(_('patch %s shelved\n' % (s.currentpatch)))
     os.chdir(cwd)