Show More
@@ -3063,29 +3063,22 b' def debugobsolete(ui, repo, precursor=No' | |||||
3063 | 'node identifiers') |
|
3063 | 'node identifiers') | |
3064 |
|
3064 | |||
3065 | if opts.get('delete'): |
|
3065 | if opts.get('delete'): | |
3066 | try: |
|
3066 | indices = [] | |
3067 |
|
|
3067 | for v in opts.get('delete'): | |
3068 | except ValueError: |
|
3068 | try: | |
3069 | raise error.Abort(_('invalid index value'), |
|
3069 | indices.append(int(v)) | |
3070 | hint=_('use integers fro indices')) |
|
3070 | except ValueError: | |
|
3071 | raise error.Abort(_('invalid index value: %r') % v, | |||
|
3072 | hint=_('use integers for indices')) | |||
3071 |
|
3073 | |||
3072 | if repo.currenttransaction(): |
|
3074 | if repo.currenttransaction(): | |
3073 |
raise error.Abort(_(' |
|
3075 | raise error.Abort(_('cannot delete obsmarkers in the middle ' | |
3074 | 'of transaction.')) |
|
3076 | 'of transaction.')) | |
3075 |
|
3077 | |||
3076 |
w |
|
3078 | with repo.lock(): | |
3077 | l = repo.lock() |
|
3079 | n = repo.obsstore.delete(indices) | |
3078 | try: |
|
3080 | ui.write(_('deleted %i obsolescense markers\n') % n) | |
3079 | tr = repo.transaction('debugobsolete') |
|
3081 | ||
3080 | try: |
|
|||
3081 | n = repo.obsstore.delete(indices) |
|
|||
3082 | ui.write(_('Deleted %i obsolescense markers\n') % n) |
|
|||
3083 | tr.close() |
|
|||
3084 | finally: |
|
|||
3085 | tr.release() |
|
|||
3086 | finally: |
|
|||
3087 | l.release() |
|
|||
3088 | w.release() |
|
|||
3089 | return |
|
3082 | return | |
3090 |
|
3083 | |||
3091 | if precursor is not None: |
|
3084 | if precursor is not None: |
@@ -629,7 +629,7 b' class obsstore(object):' | |||||
629 | return len(new) |
|
629 | return len(new) | |
630 |
|
630 | |||
631 | def delete(self, indices): |
|
631 | def delete(self, indices): | |
632 |
"""Delete some obsmarkers from store and return |
|
632 | """Delete some obsmarkers from store and return how many were deleted | |
633 |
|
633 | |||
634 | Indices is a list of ints which are the indices |
|
634 | Indices is a list of ints which are the indices | |
635 | of the markers to be deleted.""" |
|
635 | of the markers to be deleted.""" |
@@ -1106,18 +1106,17 b' only a subset of those are displayed (be' | |||||
1106 | $ hg debugobsolete --index --rev "3+7" |
|
1106 | $ hg debugobsolete --index --rev "3+7" | |
1107 | 1 6fdef60fcbabbd3d50e9b9cbc2a240724b91a5e1 d27fb9b066076fd921277a4b9e8b9cb48c95bc6a 0 \(.*\) {'user': 'test'} (re) |
|
1107 | 1 6fdef60fcbabbd3d50e9b9cbc2a240724b91a5e1 d27fb9b066076fd921277a4b9e8b9cb48c95bc6a 0 \(.*\) {'user': 'test'} (re) | |
1108 | 3 4715cf767440ed891755448016c2b8cf70760c30 7ae79c5d60f049c7b0dd02f5f25b9d60aaf7b36d 0 \(.*\) {'user': 'test'} (re) |
|
1108 | 3 4715cf767440ed891755448016c2b8cf70760c30 7ae79c5d60f049c7b0dd02f5f25b9d60aaf7b36d 0 \(.*\) {'user': 'test'} (re) | |
1109 | $ cd .. |
|
|||
1110 | $ cd .. |
|
|||
1111 |
|
1109 | |||
1112 | Test the --delete option of debugobsolete command |
|
1110 | Test the --delete option of debugobsolete command | |
1113 | $ hg init dorepo |
|
1111 | $ hg debugobsolete --index | |
1114 | $ cd dorepo |
|
1112 | 0 cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b f9bd49731b0b175e42992a3c8fa6c678b2bc11f1 0 \(.*\) {'user': 'test'} (re) | |
1115 | $ echo a > a && hg ci -Am a |
|
1113 | 1 6fdef60fcbabbd3d50e9b9cbc2a240724b91a5e1 d27fb9b066076fd921277a4b9e8b9cb48c95bc6a 0 \(.*\) {'user': 'test'} (re) | |
1116 | adding a |
|
1114 | 2 1ab51af8f9b41ef8c7f6f3312d4706d870b1fb74 29346082e4a9e27042b62d2da0e2de211c027621 0 \(.*\) {'user': 'test'} (re) | |
1117 | $ hg ci --amend -m aa |
|
1115 | 3 4715cf767440ed891755448016c2b8cf70760c30 7ae79c5d60f049c7b0dd02f5f25b9d60aaf7b36d 0 \(.*\) {'user': 'test'} (re) | |
|
1116 | $ hg debugobsolete --delete 1 --delete 3 | |||
|
1117 | deleted 2 obsolescense markers | |||
1118 | $ hg debugobsolete |
|
1118 | $ hg debugobsolete | |
1119 | cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b f9bd49731b0b175e42992a3c8fa6c678b2bc11f1 0 (.*) {'user': 'test'} (re) |
|
1119 | cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b f9bd49731b0b175e42992a3c8fa6c678b2bc11f1 0 \(.*\) {'user': 'test'} (re) | |
1120 | $ hg debugobsolete --delete 0 |
|
1120 | 1ab51af8f9b41ef8c7f6f3312d4706d870b1fb74 29346082e4a9e27042b62d2da0e2de211c027621 0 \(.*\) {'user': 'test'} (re) | |
1121 | Deleted 1 obsolescense markers |
|
|||
1122 | $ hg debugobsolete |
|
|||
1123 | $ cd .. |
|
1121 | $ cd .. | |
|
1122 |
General Comments 0
You need to be logged in to leave comments.
Login now