##// END OF EJS Templates
commands: make --rev and --index compatible in debugobsolete
Kostia Balytskyi -
r28845:5a398627 default
parent child Browse files
Show More
@@ -3122,9 +3122,6 b' def debugobsolete(ui, repo, precursor=No'
3122 3122 finally:
3123 3123 l.release()
3124 3124 else:
3125 if opts.get('rev') and opts.get('index'):
3126 hint = _("call 'hg debugobsolete --index' without other arguments")
3127 raise error.Abort(_("cannot use --index with --rev"), hint=hint)
3128 3125 if opts['rev']:
3129 3126 revs = scmutil.revrange(repo, opts['rev'])
3130 3127 nodes = [repo[r].node() for r in revs]
@@ -3133,7 +3130,23 b' def debugobsolete(ui, repo, precursor=No'
3133 3130 else:
3134 3131 markers = obsolete.getmarkers(repo)
3135 3132
3136 for i, m in enumerate(markers):
3133 markerstoiter = markers
3134 isrelevant = lambda m: True
3135 if opts.get('rev') and opts.get('index'):
3136 markerstoiter = obsolete.getmarkers(repo)
3137 markerset = set(markers)
3138 isrelevant = lambda m: m in markerset
3139
3140 for i, m in enumerate(markerstoiter):
3141 if not isrelevant(m):
3142 # marker can be irrelevant when we're iterating over a set
3143 # of markers (markerstoiter) which is bigger than the set
3144 # of markers we want to display (markers)
3145 # this can happen if both --index and --rev options are
3146 # provided and thus we need to iterate over all of the markers
3147 # to get the correct indices, but only display the ones that
3148 # are relevant to --rev value
3149 continue
3137 3150 ind = i if opts.get('index') else None
3138 3151 cmdutil.showmarker(ui, m, index=ind)
3139 3152
@@ -1083,6 +1083,30 b' Test ability to pull changeset with loca'
1083 1083 |
1084 1084 @ 0:a78f55e5508c (draft) [ ] 0
1085 1085
1086 Test that 'hg debugobsolete --index --rev' can show indices of obsmarkers when
1087 only a subset of those are displayed (because of --rev option)
1088 $ hg init doindexrev
1089 $ cd doindexrev
1090 $ echo a > a
1091 $ hg ci -Am a
1092 adding a
1093 $ hg ci --amend -m aa
1094 $ echo b > b
1095 $ hg ci -Am b
1096 adding b
1097 $ hg ci --amend -m bb
1098 $ echo c > c
1099 $ hg ci -Am c
1100 adding c
1101 $ hg ci --amend -m cc
1102 $ echo d > d
1103 $ hg ci -Am d
1104 adding d
1105 $ hg ci --amend -m dd
1106 $ hg debugobsolete --index --rev "3+7"
1107 1 6fdef60fcbabbd3d50e9b9cbc2a240724b91a5e1 d27fb9b066076fd921277a4b9e8b9cb48c95bc6a 0 \(.*\) {'user': 'test'} (re)
1108 3 4715cf767440ed891755448016c2b8cf70760c30 7ae79c5d60f049c7b0dd02f5f25b9d60aaf7b36d 0 \(.*\) {'user': 'test'} (re)
1109 $ cd ..
1086 1110 $ cd ..
1087 1111
1088 1112 Test the --delete option of debugobsolete command
General Comments 0
You need to be logged in to leave comments. Login now