##// END OF EJS Templates
shelve: make listshelves() return shelf names instead of filenames...
Martin von Zweigbergk -
r46999:a34607b6 default
parent child Browse files
Show More
@@ -630,7 +630,7 b' def deletecmd(ui, repo, pats):'
630 630
631 631
632 632 def listshelves(repo):
633 """return all shelves in repo as list of (time, filename)"""
633 """return all shelves in repo as list of (time, name)"""
634 634 try:
635 635 names = repo.vfs.readdir(shelvedir)
636 636 except OSError as err:
@@ -643,7 +643,7 b' def listshelves(repo):'
643 643 if not pfx or sfx != patchextension:
644 644 continue
645 645 mtime = Shelf(repo, pfx).mtime()
646 info.append((mtime, shelvedfile(repo, pfx).filename()))
646 info.append((mtime, pfx))
647 647 return sorted(info, reverse=True)
648 648
649 649
@@ -656,22 +656,21 b' def listcmd(ui, repo, pats, opts):'
656 656 namelabel = b'shelve.newest'
657 657 ui.pager(b'shelve')
658 658 for mtime, name in listshelves(repo):
659 sname = util.split(name)[1]
660 if pats and sname not in pats:
659 if pats and name not in pats:
661 660 continue
662 ui.write(sname, label=namelabel)
661 ui.write(name, label=namelabel)
663 662 namelabel = b'shelve.name'
664 663 if ui.quiet:
665 664 ui.write(b'\n')
666 665 continue
667 ui.write(b' ' * (16 - len(sname)))
666 ui.write(b' ' * (16 - len(name)))
668 667 used = 16
669 668 date = dateutil.makedate(mtime)
670 669 age = b'(%s)' % templatefilters.age(date, abbrev=True)
671 670 ui.write(age, label=b'shelve.age')
672 671 ui.write(b' ' * (12 - len(age)))
673 672 used += 12
674 with Shelf(repo, sname).open_patch() as fp:
673 with Shelf(repo, name).open_patch() as fp:
675 674 while True:
676 675 line = fp.readline()
677 676 if not line:
@@ -701,8 +700,7 b' def patchcmds(ui, repo, pats, opts):'
701 700 if not shelves:
702 701 raise error.Abort(_(b"there are no shelves to show"))
703 702 mtime, name = shelves[0]
704 sname = util.split(name)[1]
705 pats = [sname]
703 pats = [name]
706 704
707 705 for shelfname in pats:
708 706 if not Shelf(repo, shelfname).exists():
@@ -1122,7 +1120,7 b' def unshelvecmd(ui, repo, *shelved, **op'
1122 1120 shelved = listshelves(repo)
1123 1121 if not shelved:
1124 1122 raise error.StateError(_(b'no shelved changes to apply!'))
1125 basename = util.split(shelved[0][1])[1]
1123 basename = shelved[0][1]
1126 1124 ui.status(_(b"unshelving change '%s'\n") % basename)
1127 1125 else:
1128 1126 basename = shelved[0]
General Comments 0
You need to be logged in to leave comments. Login now