diff --git a/infinitepush/backupcommands.py b/infinitepush/backupcommands.py --- a/infinitepush/backupcommands.py +++ b/infinitepush/backupcommands.py @@ -295,9 +295,10 @@ @revsetpredicate('backedup') def backedup(repo, subset, x): """Draft changesets that have been backed up by infinitepush""" + unfi = repo.unfiltered() bkpstate = _readlocalbackupstate(repo.ui, repo) - visiblebkpheads = [head for head in bkpstate.heads if head in repo] - return subset & repo.revs('draft() and ::%ls', visiblebkpheads) + return subset & unfi.revs('draft() and ::%ls and not hidden()', + bkpstate.heads) @revsetpredicate('notbackedup') def notbackedup(repo, subset, x): @@ -320,13 +321,15 @@ candidates.update([p.hex() for p in ctx.parents()]) if notbackeduprevs: # Some revisions in this set may actually have been backed up by - # virtue of being an ancestor of a different backup head. Find these - # and remove them from the set. + # virtue of being an ancestor of a different backup head, which may + # have been hidden since the backup was made. Find these and remove + # them from the set. + unfi = repo.unfiltered() candidates = bkpheads while candidates: candidate = candidates.pop() - if candidate in repo: - ctx = repo[candidate] + if candidate in unfi: + ctx = unfi[candidate] if ctx.phase() != phases.public: notbackeduprevs.discard(ctx.rev()) candidates.update([p.hex() for p in ctx.parents()]) diff --git a/tests/test-infinitepush-backup-status.t b/tests/test-infinitepush-backup-status.t --- a/tests/test-infinitepush-backup-status.t +++ b/tests/test-infinitepush-backup-status.t @@ -3,6 +3,7 @@ > cat << EOF >> .hg/hgrc > [extensions] > fbamend=$TESTDIR/../hgext3rd/fbamend + > inhibit=$TESTDIR/../hgext3rd/inhibit.py > smartlog=$TESTDIR/../hgext3rd/smartlog.py > [infinitepushbackup] > enablestatus = True @@ -56,6 +57,22 @@ remote: * Backed up changeset (glob) remote: * Backed up changeset 2 (glob) finished in \d+\.(\d+)? seconds (re) + +Check hiding the backup head doesn't affect backed-up changesets + $ hg up -q 2 + $ hg log -T '{rev} {desc}\n' -r 'backedup()' + 2 Backed up changeset + 3 Backed up changeset 2 + $ hg log -T '{rev} {desc}\n' -r 'notbackedup()' + $ hg hide 3 + 1 changesets hidden + $ hg log -T '{rev} {desc}\n' -r 'backedup()' + 2 Backed up changeset + $ hg log -T '{rev} {desc}\n' -r 'notbackedup()' + $ hg unhide 3 + $ hg up -q 3 + +Create some changesets that aren't backed up $ echo b > file1 $ commit_time=`expr $now - 11 \* 60` $ hg commit -d "$commit_time 0" -m "Not backed up changeset"