Kiln » Unstable
Clone URL:  

Properly handle hg tag when a repository is specified on the command line with -R. Fixes bug 2075315.

Changeset 781d87b4b827

Parent 37e893cb53ab

by David Golub

Changes to 3 files · Browse files at 781d87b4b827 Showing diff from parent 37e893cb53ab Diff from another changeset...

Change 1 of 2 Show Entire File kbfiles/​bfutil.py Stacked
 
5
6
7
 
8
9
10
 
262
263
264
 
 
 
 
265
266
267
 
5
6
7
8
9
10
11
 
263
264
265
266
267
268
269
270
271
272
@@ -5,6 +5,7 @@
 import inspect  import shutil  import stat +import re    from mercurial import \   util, dirstate, cmdutil, match as match_ @@ -262,6 +263,10 @@
  if pats:   # patterns supplied: search .hgbfiles relative to current dir   cwd = repo.getcwd() + if len(cwd) > 0 and (re.match(r'[a-zA-Z]:\\', cwd) or cwd[0] == '/'): + # cwd is an absolute path for hg -R <reponame> + # work relative to the repository root in this case + cwd = ''   pats = [os.path.join(standin_dir, cwd, pat) for pat in pats]   elif os.path.isdir(standin_dir):   # no patterns: relative to repo root
 
252
253
254
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
@@ -252,3 +252,78 @@
 hgt.asserttrue(hgt.readfile('.hgtags') == 'd82117283c29e97adb8ebbcc5ea8fb7613ad0864 first\n73960f5ccfe2ca2f74002e55d74f186678f53872 second\n', "hgtags doesn't match")  hgt.hg(['up', '-r', '4'], stdout='1 files updated, 0 files merged, 0 files removed, 0 files unresolved\n')  hgt.asserttrue(hgt.readfile('.hgtags') == 'd82117283c29e97adb8ebbcc5ea8fb7613ad0864 first\n73960f5ccfe2ca2f74002e55d74f186678f53872 second\ne229b8d1bac18cbd3eef20f9433c076fe45fa97d last\n', "hgtags doesn't match") +os.chdir('..') +hgt.hg(['tag', '-R', 'repo3', 'fromroot']) +hgt.hg(['log', '-R', 'repo3'], stdout='''changeset: 5:d9771069dce1 +tag: tip +user: test +date: Thu Jan 01 00:00:00 1970 +0000 +summary: Added tag fromroot for changeset c4495ce62a60 + +changeset: 4:c4495ce62a60 +tag: fromroot +user: test +date: Thu Jan 01 00:00:00 1970 +0000 +summary: Added tag last for changeset e229b8d1bac1 + +changeset: 3:e229b8d1bac1 +tag: last +user: test +date: Thu Jan 01 00:00:00 1970 +0000 +summary: Added tag second for changeset 73960f5ccfe2 + +changeset: 2:d41643b333a9 +user: test +date: Thu Jan 01 00:00:00 1970 +0000 +summary: Added tag first for changeset d82117283c29 + +changeset: 1:73960f5ccfe2 +tag: second +user: test +date: Thu Jan 01 00:00:00 1970 +0000 +summary: add more files + +changeset: 0:d82117283c29 +tag: first +user: test +date: Thu Jan 01 00:00:00 1970 +0000 +summary: initial commit + +''') +hgt.hg(['tag', '-R', 'repo2', 'fromroot']) +hgt.hg(['log', '-R', 'repo2'], stdout='''changeset: 5:e861e23e4324 +tag: tip +user: test +date: Thu Jan 01 00:00:00 1970 +0000 +summary: Added tag fromroot for changeset d6940222c000 + +changeset: 4:d6940222c000 +tag: fromroot +user: test +date: Thu Jan 01 00:00:00 1970 +0000 +summary: Added tag last for changeset e229b8d1bac1 + +changeset: 3:3c50e5db9993 +tag: last +user: test +date: Thu Jan 01 00:00:00 1970 +0000 +summary: Added tag second for changeset 73960f5ccfe2 + +changeset: 2:4a283e03a784 +user: test +date: Thu Jan 01 00:00:00 1970 +0000 +summary: Added tag first for changeset d82117283c29 + +changeset: 1:a633211558b8 +tag: second +user: test +date: Thu Jan 01 00:00:00 1970 +0000 +summary: add more files + +changeset: 0:494d68993338 +tag: first +user: test +date: Thu Jan 01 00:00:00 1970 +0000 +summary: initial commit + +''')
 
31
32
33
 
 
 
 
 
31
32
33
34
35
36
37
@@ -31,3 +31,7 @@
 hg up -r 2  hg up -r 3  hg up -r 4 +hg tag -R repo3 fromroot +hg log -R repo3 +hg tag -R repo2 fromroot +hg log -R repo2