Commits

Anonymous committed a20d61a

Support for old location of shelve file.

If the shelve file at the old location is found,
it uses that instead, for unshelve and append
operations.

  • Participants
  • Parent commits 23a1cd8

Comments (0)

Files changed (1)

     
     resp_all = [None]
 
-    # If we're not to prompt (i.e. they specified the --all flag) we pre-emptively set the 'all' flag
+    """ If we're not to prompt (i.e. they specified the --all flag) 
+        we pre-emptively set the 'all' flag """
     if shouldprompt == False:
         resp_all = ['y']
     
 
     return backups
 
-def getshelfpath(name):
+def getshelfpath(repo,name):
     if name:
         shelfpath = "shelves/" + name
     else:
-        shelfpath = "shelves/default"
+        " Check if a shelf from an older version exists "
+        if os.path.isfile(repo.join('shelve')):
+            shelfpath = 'shelve'
+        else:
+            shelfpath = "shelves/default"
     
     return shelfpath
     
     
     ' Shelf name and path '
     shelfname = opts.get('name')
-    shelfpath = getshelfpath(shelfname)
+    shelfpath = getshelfpath(repo,shelfname)
     
     if os.path.exists(repo.join(shelfpath)) and not forced:
         raise util.Abort(_('shelve data already exists'))
 
     ' Shelf name and path '
     shelfname = opts.get('name')
-    shelfpath = getshelfpath(shelfname)
+    shelfpath = getshelfpath(repo,shelfname)
 
     ' List all the active shelves by name and return '
     if opts['list']:
-        for filename in os.listdir(repo.join('shelves')):
-            print filename
+        dirname = repo.join('shelves')
+        if os.path.isdir(dirname):
+            for filename in os.listdir(repo.join('shelves')):
+                print filename
         return
         
     try: